Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports DevExpress.Xpf.Grid
Imports System.Windows.Data
Imports System.Windows
Imports System.Windows.Controls
Imports DevExpress.Xpf.Grid.TreeList
Imports System.Windows.Media
Imports DevExpress.Xpf.Editors
Imports System.Collections.ObjectModel
Imports DevExpress.Xpf.DemoBase.DataClasses
Imports DevExpress.Xpf.Utils
Imports DevExpress.Xpf.Core
Namespace TreeListDemo
Public Class NavigationStyleList
Inherits List(Of GridViewNavigationStyle)
End Class
#Region "Converters"
Public Class ShowTreeListLinesConverter
Implements IValueConverter
#Region "IValueConverter Members"
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Return CType(value, TreeListLineStyle) <> TreeListLineStyle.None
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Return If(CBool(value), TreeListLineStyle.Solid, TreeListLineStyle.None)
End Function
#End Region
End Class
Public Class AlertVisibilityConverter
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Return If(CBool(value), Visibility.Visible, Visibility.Collapsed)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class PriorityTemplateSelector
Implements IValueConverter
Private privateHighTemplate As DataTemplate
Public Property HighTemplate() As DataTemplate
Get
Return privateHighTemplate
End Get
Set(ByVal value As DataTemplate)
privateHighTemplate = value
End Set
End Property
Private privateNormalTemplate As DataTemplate
Public Property NormalTemplate() As DataTemplate
Get
Return privateNormalTemplate
End Get
Set(ByVal value As DataTemplate)
privateNormalTemplate = value
End Set
End Property
Private privateLowTemplate As DataTemplate
Public Property LowTemplate() As DataTemplate
Get
Return privateLowTemplate
End Get
Set(ByVal value As DataTemplate)
privateLowTemplate = value
End Set
End Property
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim rowData As TreeListRowData = TryCast(value, TreeListRowData)
If rowData IsNot Nothing Then
Dim task As Task = TryCast(rowData.Row, Task)
If task IsNot Nothing Then
Select Case task.Priority
Case Priority.Low
Return LowTemplate
Case Priority.Normal
Return NormalTemplate
Case Priority.High
Return HighTemplate
End Select
End If
End If
Return Nothing
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class ObjectIsTaskConverter
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Return TypeOf value Is Task
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class SummaryIconVisibilityConverter
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
If value Is Nothing Then
Return Nothing
End If
If value.GetType() Is GetType(TaskObject) Then
Return Visibility.Collapsed
Else
Return Visibility.Visible
End If
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class CountryToFlagImageConverter
Inherits BytesToImageSourceConverter
Public Overrides Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object
For Each item As Country In CountriesData.DataSource
If item.Name = CStr(value) Then
Return MyBase.Convert(item.Flag, targetType, parameter, culture)
End If
Next item
Return Nothing
End Function
End Class
#End Region
Public NotInheritable Class DragDropSourceGenerator
Private Sub New()
End Sub
Public Shared Sub InitSources(ByVal viewModel As DragDropViewModel)
Dim all As List(Of Employee) = EmployeesData.DataSource
viewModel.NewEmployees = New ObservableCollection(Of Employee)(all.Where(Function(e) NewEmployessIds.Contains(e.Id)))
all.RemoveAll(Function(e) NewEmployessIds.Contains(e.Id))
viewModel.ActiveEmployees = New ObservableCollection(Of Employee)(all)
End Sub
Private Shared NewEmployessIds As New List(Of Integer)(New Integer() { 106, 002, 176, 128, 278, 231, 198, 201, 272, 275, 277, 269, 068, 081, 032, 032, 062, 134, 183, 033, 243, 255, 180, 121, 034, 110, 067 })
End Class
Public Class TaskContentControl
Inherits ContentControl
Public Shared ReadOnly ShowBorderProperty As DependencyProperty = DependencyPropertyManager.Register("ShowBorder", GetType(Boolean), GetType(TaskContentControl), New PropertyMetadata(False))
Public Sub New()
Me.SetDefaultStyleKey(GetType(TaskContentControl))
End Sub
Public Property ShowBorder() As Boolean
Get
Return CBool(GetValue(ShowBorderProperty))
End Get
Set(ByVal value As Boolean)
SetValue(ShowBorderProperty, value)
End Set
End Property
End Class
End Namespace