Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WPF/VB/BarsDemo.Wpf/Modules/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WPF/VB/BarsDemo.Wpf/Modules/ItemProperties.xaml.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Markup
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports DevExpress.Xpf.Bars
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Utils
Namespace BarsDemo
	Public Class DockEnumProvider
		Public ReadOnly Property DockItemsSource() As IEnumerable
			Get
				Dim dockItems As New List(Of Dock)()
				dockItems.Add(Dock.Left)
				dockItems.Add(Dock.Top)
				dockItems.Add(Dock.Right)
				dockItems.Add(Dock.Bottom)
				Return dockItems
			End Get
		End Property
		Public ReadOnly Property DockRightBottomItemsSource() As IEnumerable
			Get
				Dim dockItems As New List(Of Dock)()
				dockItems.Add(Dock.Right)
				dockItems.Add(Dock.Bottom)
				Return dockItems
			End Get
		End Property
	End Class
	Partial Public Class ItemProperties
		Inherits BarsDemoModule
		Public Shared ReadOnly SelectedItemProperty As DependencyProperty = DependencyPropertyManager.Register("SelectedItem", GetType(BarItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Shared ReadOnly ButtonItemProperty As DependencyProperty = DependencyPropertyManager.Register("ButtonItem", GetType(BarButtonItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Shared ReadOnly CheckItemProperty As DependencyProperty = DependencyPropertyManager.Register("CheckItem", GetType(BarCheckItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Shared ReadOnly StaticItemProperty As DependencyProperty = DependencyPropertyManager.Register("StaticItem", GetType(BarStaticItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Shared ReadOnly SplitButtonItemProperty As DependencyProperty = DependencyPropertyManager.Register("SplitButtonItem", GetType(BarSplitButtonItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Shared ReadOnly SubItemProperty As DependencyProperty = DependencyPropertyManager.Register("SubItem", GetType(BarSubItemLink), GetType(ItemProperties), New FrameworkPropertyMetadata())
		Public Property SelectedItem() As BarItemLink
			Get
				Return CType(GetValue(SelectedItemProperty), BarItemLink)
			End Get
			Set(ByVal value As BarItemLink)
				SetValue(SelectedItemProperty, value)
			End Set
		End Property
		Public Property ButtonItem() As BarButtonItemLink
			Get
				Return CType(GetValue(ButtonItemProperty), BarButtonItemLink)
			End Get
			Set(ByVal value As BarButtonItemLink)
				SetValue(ButtonItemProperty, value)
			End Set
		End Property
		Public Property CheckItem() As BarCheckItemLink
			Get
				Return CType(GetValue(CheckItemProperty), BarCheckItemLink)
			End Get
			Set(ByVal value As BarCheckItemLink)
				SetValue(CheckItemProperty, value)
			End Set
		End Property
		Public Property StaticItem() As BarStaticItemLink
			Get
				Return CType(GetValue(StaticItemProperty), BarStaticItemLink)
			End Get
			Set(ByVal value As BarStaticItemLink)
				SetValue(StaticItemProperty, value)
			End Set
		End Property
		Public Property SplitButtonItem() As BarSplitButtonItemLink
			Get
				Return CType(GetValue(SplitButtonItemProperty), BarSplitButtonItemLink)
			End Get
			Set(ByVal value As BarSplitButtonItemLink)
				SetValue(SplitButtonItemProperty, value)
			End Set
		End Property
		Public Property SubItem() As BarSubItemLink
			Get
				Return CType(GetValue(SubItemProperty), BarSubItemLink)
			End Get
			Set(ByVal value As BarSubItemLink)
				SetValue(SubItemProperty, value)
			End Set
		End Property

		Public Sub New()
			InitializeComponent()
			ButtonItem = CType(Me.barManager.Bars(0).ItemLinks(0), BarButtonItemLink)
			CheckItem = CType(Me.barManager.Bars(0).ItemLinks(1), BarCheckItemLink)
			StaticItem = CType(Me.barManager.Bars(1).ItemLinks(0), BarStaticItemLink)
			SplitButtonItem = CType(Me.barManager.Bars(0).ItemLinks(2), BarSplitButtonItemLink)
			SubItem = CType(Me.barManager.Bars(0).ItemLinks(3), BarSubItemLink)
			SelectedItem = ButtonItem
			OnRadioButtonClick(newRadioButton, Nothing)
		End Sub

		Protected Overridable Sub SelectItem(ByVal radioButton As Object)
			If radioButton Is Me.newRadioButton Then
				SelectedItem = ButtonItem
			ElseIf radioButton Is Me.bulletsRadioButton Then
				SelectedItem = CheckItem
			ElseIf radioButton Is Me.saveMenuRadioButton Then
				SelectedItem = SubItem
			ElseIf radioButton Is Me.fontColorRadioButton Then
				SelectedItem = SplitButtonItem
			Else
				SelectedItem = StaticItem
			End If
		End Sub
		Protected Overridable Sub UpdateSettingsVisibility()
			Me.subProps.Visibility = If((SelectedItem Is SubItem), Visibility.Visible, Visibility.Collapsed)
			Me.staticProperties.Visibility = If((SelectedItem Is StaticItem), Visibility.Visible, Visibility.Collapsed)
			Me.splitProps.Visibility = If((SelectedItem Is SplitButtonItem), Visibility.Visible, Visibility.Collapsed)
		End Sub
		Protected Overridable Sub UpdateSettingsValues()
			Me.displayMode.SelectedIndex = CInt(Fix(SelectedItem.BarItemDisplayMode))
			If SelectedItem.UserGlyphAlignment Is Nothing Then
				Me.captionGlyphAlignment.SelectedIndex = 0
			Else
				Me.captionGlyphAlignment.SelectedIndex = CInt(Fix(SelectedItem.UserGlyphAlignment))
			End If
			Me.glyphSize.SelectedIndex = CInt(Fix(SelectedItem.UserGlyphSize))
		End Sub
		Protected Overridable Sub OnRadioButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
			SelectItem(sender)
			UpdateSettingsVisibility()
			UpdateSettingsValues()
		End Sub
		Protected Overridable Sub displayMode_SelectedIndexChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
			If Me.displayMode.SelectedItem Is Nothing Then
				Return
			End If
			Dim itemDisplayMode As BarItemDisplayMode = CType(Me.displayMode.SelectedItem, BarItemDisplayMode)
			Me.captionGlyphAlignment.IsEnabled = itemDisplayMode.Equals(BarItemDisplayMode.ContentAndGlyph)
		End Sub
		Protected Overridable Sub captionGlyphAlignment_SelectedIndexChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
			If Me.displayMode.SelectedItem Is Nothing Then
				Return
			End If
			Dim itemDisplayMode As BarItemDisplayMode = CType(Me.displayMode.SelectedItem, BarItemDisplayMode)
			Me.glyphSize.IsEnabled = itemDisplayMode.Equals(BarItemDisplayMode.ContentAndGlyph) OrElse itemDisplayMode.Equals(BarItemDisplayMode.Default)
		End Sub
		Protected Overridable Sub autoSizeMode_SelectedIndexChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
			If Me.autoSizeMode.SelectedItem Is Nothing Then
				Return
			End If
			Dim itemAutoSizeMode As BarItemAutoSizeMode = CType(Me.autoSizeMode.SelectedItem, BarItemAutoSizeMode)
			Me.widthTrackBar.IsEnabled = itemAutoSizeMode.Equals(BarItemAutoSizeMode.None)
		End Sub
		Protected Overridable Sub actAsDropDownCheck_EditValueChanged(ByVal sender As Object, ByVal e As DevExpress.Xpf.Editors.EditValueChangedEventArgs)
			Me.arrowAlignment.IsEnabled = Not Me.actAsDropDownCheck.IsChecked.Value
		End Sub
	End Class
	Public Class BarItemInfoControl
		Inherits ContentControl
		Public Shared ReadOnly LinkProperty As DependencyProperty = DependencyPropertyManager.Register("Link", GetType(BarItemLink), GetType(BarItemInfoControl), New FrameworkPropertyMetadata())
		Public Shared ReadOnly DescriptionProperty As DependencyProperty = DependencyPropertyManager.Register("Description", GetType(String), GetType(BarItemInfoControl), New FrameworkPropertyMetadata(String.Empty))
		Public Property Link() As BarItemLink
			Get
				Return CType(GetValue(LinkProperty), BarItemLink)
			End Get
			Set(ByVal value As BarItemLink)
				SetValue(LinkProperty, value)
			End Set
		End Property
		Public Property Description() As String
			Get
				Return CStr(GetValue(DescriptionProperty))
			End Get
			Set(ByVal value As String)
				SetValue(DescriptionProperty, value)
			End Set
		End Property

		Public Sub New()
			DefaultStyleKey = GetType(BarItemInfoControl)
			Focusable = False
		End Sub
	End Class
End Namespace