diff --git a/Readme.md b/Readme.md
index 2cb01c1..a7b97a1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,5 +1,4 @@
-
[](https://supportcenter.devexpress.com/ticket/details/T587301)
[](https://docs.devexpress.com/GeneralInformation/403183)
diff --git a/VB/ColorMappingExample/ColorMappingExample.Net5.vbproj b/VB/ColorMappingExample/ColorMappingExample.Net5.vbproj
index 09faa9c..e4378b6 100644
--- a/VB/ColorMappingExample/ColorMappingExample.Net5.vbproj
+++ b/VB/ColorMappingExample/ColorMappingExample.Net5.vbproj
@@ -1,4 +1,4 @@
-
+
On
@@ -41,4 +41,4 @@
-
+
\ No newline at end of file
diff --git a/VB/ColorMappingExample/ColorMappingExample.vbproj b/VB/ColorMappingExample/ColorMappingExample.vbproj
index 4948955..44764cb 100644
--- a/VB/ColorMappingExample/ColorMappingExample.vbproj
+++ b/VB/ColorMappingExample/ColorMappingExample.vbproj
@@ -1,4 +1,4 @@
-
+
On
@@ -92,7 +92,7 @@
MSBuild:Compile
Designer
-
+
MSBuild:Compile
@@ -108,7 +108,6 @@
-
Code
@@ -146,4 +145,4 @@
-->
-
+
\ No newline at end of file
diff --git a/VB/ColorMappingExample/MainWindow.xaml b/VB/ColorMappingExample/MainWindow.xaml
index 8fba0a4..ceb1575 100644
--- a/VB/ColorMappingExample/MainWindow.xaml
+++ b/VB/ColorMappingExample/MainWindow.xaml
@@ -7,39 +7,24 @@
xmlns:local="clr-namespace:ColorMappingExample"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduling"
- xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:viewmodels="clr-namespace:ColorMappingExample.ViewModels"
Height="600"
Width="800"
mc:Ignorable="d"
- DataContext="{dxmvvm:ViewModelSource viewmodels:MainViewModel}"
Title="MainWindow">
-
+
+
+
-
-
-
-
-
-
-
-
-
+
-
+
-
diff --git a/VB/ColorMappingExample/MainWindow.xaml.vb b/VB/ColorMappingExample/MainWindow.xaml.vb
index d32d0de..34a9ea1 100644
--- a/VB/ColorMappingExample/MainWindow.xaml.vb
+++ b/VB/ColorMappingExample/MainWindow.xaml.vb
@@ -9,4 +9,10 @@ Namespace ColorMappingExample
Me.InitializeComponent()
End Sub
End Class
+
+ Public Enum Priority
+ High
+ Normal
+ Low
+ End Enum
End Namespace
diff --git a/VB/ColorMappingExample/Model/MyAppointment.vb b/VB/ColorMappingExample/Model/MyAppointment.vb
index 149f09f..b753dbd 100644
--- a/VB/ColorMappingExample/Model/MyAppointment.vb
+++ b/VB/ColorMappingExample/Model/MyAppointment.vb
@@ -1,21 +1,13 @@
-Imports DevExpress.Mvvm.POCO
-
Namespace ColorMappingExample.Model
Public Class MyAppointment
- Public Shared Function Create() As MyAppointment
- Return ViewModelSource.Create(Function() New MyAppointment())
- End Function
-
- Friend Shared Function Create(ByVal startTime As Date, ByVal endTime As Date, ByVal subject As String, ByVal categoryId As Integer) As MyAppointment
- Dim apt As MyAppointment = Create()
- apt.StartTime = startTime
- apt.EndTime = endTime
- apt.Subject = subject
- apt.CategoryId = categoryId
- Return apt
- End Function
+ Public Sub New(ByVal startTime As Date, ByVal endTime As Date, ByVal subject As String, ByVal priorityId As Priority)
+ Me.StartTime = startTime
+ Me.EndTime = endTime
+ Me.Subject = subject
+ Me.PriorityId = priorityId
+ End Sub
Protected Sub New()
End Sub
@@ -32,7 +24,7 @@ Namespace ColorMappingExample.Model
Public Overridable Property StatusId As Integer
- Public Overridable Property CategoryId As Integer
+ Public Overridable Property PriorityId As Priority
Public Overridable Property Type As Integer
diff --git a/VB/ColorMappingExample/PriorityToColorConverter.vb b/VB/ColorMappingExample/PriorityToColorConverter.vb
new file mode 100644
index 0000000..80eb783
--- /dev/null
+++ b/VB/ColorMappingExample/PriorityToColorConverter.vb
@@ -0,0 +1,48 @@
+Imports System
+Imports System.Globalization
+Imports System.Windows.Data
+Imports System.Windows.Markup
+Imports System.Windows.Media
+
+Namespace ColorMappingExample
+
+ Friend Class PriorityToColorConverter
+ Inherits MarkupExtension
+ Implements IValueConverter
+
+ Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
+ Dim val As Priority = Nothing
+ If CSharpImpl.__Assign(val, TryCast(value, Priority)) IsNot Nothing Then
+ Select Case val
+ Case Priority.High
+ Return Colors.Red
+ Case Priority.Normal
+ Return Colors.Yellow
+ Case Priority.Low
+ Return Colors.Green
+ Case Else
+ Return Colors.Black
+ End Select
+ End If
+
+ Return Colors.Transparent
+ End Function
+
+ Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+ Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
+ Return Me
+ End Function
+
+ Private Class CSharpImpl
+
+
+ Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
+ target = value
+ Return value
+ End Function
+ End Class
+ End Class
+End Namespace
diff --git a/VB/ColorMappingExample/ViewModels/MainViewModel.vb b/VB/ColorMappingExample/ViewModels/MainViewModel.vb
index 492f0ad..f838bfb 100644
--- a/VB/ColorMappingExample/ViewModels/MainViewModel.vb
+++ b/VB/ColorMappingExample/ViewModels/MainViewModel.vb
@@ -1,45 +1,21 @@
Imports ColorMappingExample.Model
-Imports DevExpress.Mvvm.DataAnnotations
+Imports DevExpress.Mvvm
Imports System.Collections.ObjectModel
-Imports System.Windows.Media
Namespace ColorMappingExample.ViewModels
-
Public Class MainViewModel
+ Inherits ViewModelBase
- Public Overridable Property Appointments As ObservableCollection(Of MyAppointment)
+ Public Property Appointments As ObservableCollection(Of MyAppointment)
- Public Overridable Property Categories As ObservableCollection(Of Category)
-
- Public Overridable Property ColorSavingType As DevExpress.Xpf.Scheduling.DXColorSavingType
-
- Protected Sub New()
+ Public Sub New()
Appointments = CreateAppointments()
- Categories = CreateCategories()
End Sub
Private Function CreateAppointments() As ObservableCollection(Of MyAppointment)
- Dim result As ObservableCollection(Of MyAppointment) = New ObservableCollection(Of MyAppointment)()
- result.Add(MyAppointment.Create(Date.Today.AddHours(10), Date.Today.AddHours(11), "TEST", 1))
- Return result
- End Function
-
-#Region "#CreateCategories"
- Private Function CreateCategories() As ObservableCollection(Of Category)
- Dim result As ObservableCollection(Of Category) = New ObservableCollection(Of Category)()
- result.Add(Category.Create(0, "Blank category", "0xFFFFFFFF"))
- ' Set the AppointmentLabelMappings.ColorSavingType to ColorString
- ' and use the HtmlColorCodeToHexConverter.
- ' Otherwise color values assigned as follows will be translated incorrectly.
- result.Add(Category.Create(1, "Color category", Colors.Orange.ToString()))
- result.Add(Category.Create(2, "Red category", "Red"))
- ''' Set the AppointmentLabelMappings.ColorSavingType to ColorInstance.
- ''' Otherwise color values assigned as follows will be translated incorrectly.
- 'result.Add(Category.Create(1, "Color category", Colors.Orange));
- 'result.Add(Category.Create(3, "Red category", Colors.Red));
+ Dim result As ObservableCollection(Of MyAppointment) = New ObservableCollection(Of MyAppointment) From {New MyAppointment(Date.Today.AddHours(10), Date.Today.AddHours(11), "TEST", Priority.Normal)}
Return result
End Function
-#End Region ' #CreateCategories
End Class
End Namespace