-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindow1.xaml.vb
68 lines (55 loc) · 2.58 KB
/
Window1.xaml.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Data
Imports System.Windows.Markup
Imports System.Windows.Media
Imports System.ComponentModel
Imports System
Imports DevExpress.Xpf.Grid
Namespace DXGrid_ConditionalFormatting
Public Partial Class Window1
Inherits Window
Public Sub New()
Me.InitializeComponent()
Me.grid.ItemsSource = Products.GetData()
End Sub
End Class
Public Class ColumnRowIndexesCellValueConverter
Inherits MarkupExtension
Implements IMultiValueConverter
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
'#Region "IMultiValueConverter Members"
Public Function Convert(ByVal values As Object(), ByVal targetType As Type, ByVal parameter As Object, ByVal culture As Globalization.CultureInfo) As Object Implements IMultiValueConverter.Convert
If values(0) Is Nothing Then Return Brushes.Transparent
Dim columnIndex As Integer = CInt(TryCast(values(0), GridColumn).VisibleIndex)
Dim rowIndex As Integer = CInt(values(1))
If columnIndex = 1 AndAlso rowIndex = 1 Then
Return Brushes.Red
Else
Return Brushes.Transparent
End If
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetTypes As Type(), ByVal parameter As Object, ByVal culture As Globalization.CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
'#End Region
End Class
Public Class Products
Public Shared Function GetData() As List(Of Product)
Dim data As List(Of Product) = New List(Of Product)()
data.Add(New Product() With {.ProductName = "Chai", .UnitPrice = 18, .UnitsOnOrder = 10})
data.Add(New Product() With {.ProductName = "Ipoh Coffee", .UnitPrice = 36.8, .UnitsOnOrder = 12})
data.Add(New Product() With {.ProductName = "Outback Lager", .UnitPrice = 12, .UnitsOnOrder = 25})
data.Add(New Product() With {.ProductName = "Boston Crab Meat", .UnitPrice = 18.4, .UnitsOnOrder = 18})
data.Add(New Product() With {.ProductName = "Konbu", .UnitPrice = 6, .UnitsOnOrder = 24})
Return data
End Function
End Class
Public Class Product
Public Property ProductName As String
Public Property UnitPrice As Double
Public Property UnitsOnOrder As Integer
End Class
End Namespace