This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
/
MainWindow.xaml
62 lines (62 loc) · 3.59 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
<Window x:Class="WpfApplication15.MainWindow"
xmlns:local="clr-namespace:WpfApplication15"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxgc="http://schemas.devexpress.com/winfx/2008/xaml/grid/internal"
Title="MainWindow" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Loaded="Window_Loaded"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" SizeToContent="WidthAndHeight">
<Window.Resources>
<DataTemplate x:Key="rowDetailsTemplate">
<Expander x:Name="expander" Grid.Row="1" IsExpanded="{Binding Path=RowState.(local:MainWindow.Expanded)}" ExpandDirection="Down">
<dxg:GridControl x:Name="detail" Height="200" Margin="0,3,10,3" DockPanel.Dock="Top" Visibility="Collapsed" AutoPopulateColumns="True">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="ProductID" />
<dxg:GridColumn FieldName="ProductModelID" />
<dxg:GridColumn FieldName="Name" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" NavigationStyle="Row" AllowMoving="False" ShowGroupPanel="False" />
</dxg:GridControl.View>
</dxg:GridControl>
<Expander.IsEnabled>
<MultiBinding>
<MultiBinding.Converter>
<local:MyConverterExpanderState />
</MultiBinding.Converter>
<Binding Path="(dxg:GridControl.ActiveView)" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="RowHandle.Value" />
</MultiBinding>
</Expander.IsEnabled>
</Expander>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=RowState.(local:MainWindow.Expanded)}" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="detail" />
<Setter Property="ItemsSource" TargetName="detail">
<Setter.Value>
<MultiBinding>
<MultiBinding.Converter>
<local:MyConverter />
</MultiBinding.Converter>
<Binding Path="(dxg:GridControl.ActiveView)" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="RowHandle.Value" />
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Window.Resources>
<Grid>
<dxg:GridControl Name="gridControl1" DesignTimeShowSampleData="False">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="ProductModelID" />
<dxg:GridColumn FieldName="Name" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView Name="view" AutoWidth="True" NavigationStyle="Row" RowDetailsTemplate="{StaticResource rowDetailsTemplate}" RowDetailsVisibilityMode="Visible" />
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</Window>