-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThemeParametersSelector.ascx.vb
54 lines (51 loc) · 2.33 KB
/
ThemeParametersSelector.ascx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Option Infer On
Imports DevExpress.Web
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Public Class UserControl_ThemeParametersSelector
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Utils.CanChangeBaseColor Then
BaseColorEditor.DataSource = Utils.CustomBaseColors.Select(Function(c) New With { _
Key .Value = c, _
Key .ImageUrl = Utils.GetColoredSquareUrl(c) _
})
BaseColorEditor.DataBind()
Dim currentBaseColor As String = If(String.IsNullOrWhiteSpace(Utils.CurrentBaseColor), Utils.GetDefaultBaseColor(Utils.CurrentTheme), Utils.CurrentBaseColor)
Dim item = BaseColorEditor.Items.FindByValue(currentBaseColor)
If item IsNot Nothing Then
item.Selected = True
End If
End If
FontEditor.DataSource = Utils.GetFontFamiliesDataSource().Select(Function(i) New With { _
Key .Value = i.Value, _
Key .Text = i.Text, _
Key .ImageUrl = "" _
})
FontEditor.DataBind()
FontEditor.SelectedIndex = If(Not String.IsNullOrEmpty(ASPxWebControl.GlobalThemeFont), FontEditor.Items.IndexOfValue(ASPxWebControl.GlobalThemeFont), 0)
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
InitEditor(BaseColorEditor)
InitEditor(FontEditor)
End Sub
Protected Sub InitEditor(ByVal editor As ASPxComboBox)
editor.DropDownStyle = DropDownStyle.DropDownList
editor.ValueField = "Value"
editor.ImageUrlField = "ImageUrl"
editor.ShowImageInEditBox = True
editor.CssClass &= " themes-parameters-editor"
editor.CaptionSettings.Position = EditorCaptionPosition.Top
editor.CaptionSettings.ShowColon = False
editor.CaptionStyle.CssClass = "themes-parameters-caption"
editor.ListBoxStyle.CssClass &= " themes-parameters-listbox"
editor.ButtonStyle.CssClass = "themes-parameters-button-edit"
editor.DropDownButton.Image.SpriteProperties.CssClass = "icon drop-down"
editor.DropDownButton.Image.Height = 12
editor.DropDownButton.Image.Width = 12
End Sub
End Class