This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
/
MainWindow.xaml
70 lines (62 loc) · 2.83 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
67
68
69
70
<Window Height="400"
mc:Ignorable="d"
Width="600"
x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:local="clr-namespace:WpfApplication2"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<local:CollectionToIsCheckedConverter x:Key="isCheckedConverter" />
<local:CollectionToIsThreeStateConverter x:Key="isThreeStateConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Click="BtnInvert_Click" Content="Invert selection" />
<Button Grid.Column="1" Click="BtnGetSelected_Click" Content="Get selection" />
</Grid>
<dxg:GridControl Grid.Row="1" Name="grid" ItemsSource="{Binding List}" CustomUnboundColumnData="grid_CustomUnboundColumnData">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id" />
<dxg:GridColumn FieldName="Number" />
<dxg:GridColumn FieldName="Selected" UnboundType="Boolean" AllowSorting="False">
<dxg:GridColumn.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<dxe:CheckEdit Margin="0,0,4,0" EditValueChanged="CheckEdit_EditValueChanged" >
<dxe:CheckEdit.IsThreeState>
<MultiBinding Mode="OneWay" Converter="{StaticResource isThreeStateConverter}">
<Binding Path="DataContext.SelectedValues" RelativeSource="{RelativeSource AncestorType=dxg:GridControl}" />
<Binding Path="DataContext" RelativeSource="{RelativeSource AncestorType=dxg:GridControl}" />
</MultiBinding>
</dxe:CheckEdit.IsThreeState>
<dxe:CheckEdit.IsChecked>
<MultiBinding Mode="OneWay" Converter="{StaticResource isCheckedConverter}">
<Binding Path="DataContext.SelectedValues" RelativeSource="{RelativeSource AncestorType=dxg:GridControl}" />
<Binding Path="DataContext" RelativeSource="{RelativeSource AncestorType=dxg:GridControl}" />
</MultiBinding>
</dxe:CheckEdit.IsChecked>
</dxe:CheckEdit>
<TextBlock Text="{Binding}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</dxg:GridColumn.HeaderTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" CellValueChanging="view_CellValueChanging" />
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</Window>