-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
66 lines (55 loc) · 3.09 KB
/
MainWindow.xaml
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
<Window
x:Class="DXGridSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:DXGridSample"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Name="win"
Title="MainWindow"
Width="525"
Height="350">
<Window.DataContext>
<local:ViewModel />
</Window.DataContext>
<DockPanel>
<dxe:CheckEdit Content="Highlight visited" DockPanel.Dock="Top" EditValue="{Binding HighlightVisited, UpdateSourceTrigger=PropertyChanged}" />
<dxg:GridControl ItemsSource="{Binding Items}">
<dxg:GridColumn FieldName="Country" />
<dxg:GridColumn EditSettings="{dxe:PopupColorEditSettings}" FieldName="Color" />
<dxg:GridColumn EditSettings="{dxe:SpinSettings IsFloatValue=False}" FieldName="Visits" />
<dxg:GridColumn
FieldName="Visited"
ShowInColumnChooser="False"
UnboundExpression="[Visits] > 0"
UnboundDataType="{x:Type sys:Boolean}"
Visible="False" />
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" EnableImmediatePosting="True" RowDetailsVisibilityMode="VisibleWhenFocused">
<dxg:TableView.RowStyle>
<Style TargetType="dxg:RowControl">
<Style.Triggers>
<Trigger Property="SelectionState" Value="None">
<!-- bind Background to the Item.Color property -->
<Setter Property="Background" Value="{Binding Row.Color, Converter={dxmvvm:ColorToBrushConverter}}" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<!-- obtain ViewModel.HighlightVisited -->
<Condition Binding="{Binding View.DataContext.HighlightVisited}" Value="True" />
<!-- obtain the Visited column value -->
<Condition Binding="{Binding DataContext.Visited}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="TextElement.FontStyle" Value="Italic" />
<Setter Property="TextElement.FontWeight" Value="Bold" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</dxg:TableView.RowStyle>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</DockPanel>
</Window>