-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
49 lines (45 loc) · 2.25 KB
/
MainWindow.xaml
File metadata and controls
49 lines (45 loc) · 2.25 KB
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
<Window x:Class="VisualTreeCollapseIssue001.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VisualTreeCollapseIssue001"
xmlns:vc="clr-namespace:VisualTreeCollapseIssue001.ValueConverters"
xmlns:vm="clr-namespace:VisualTreeCollapseIssue001.ViewModels"
mc:Ignorable="d"
Title="MainWindow"
Height="450"
Width="800">
<Window.Resources>
<vc:VisibilityToBooleanConverter x:Key="VisibilityToBooleanConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<DataGrid Name="ExampleDataGrid">
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Expander IsExpanded="{Binding DetailsVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Converter={StaticResource VisibilityToBooleanConverter}}"/>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Id}" Header="Id" Width="Auto" />
<DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="*"/>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<TextBox />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
<vm:ItemViewModel Id="1" Name="First" />
<vm:ItemViewModel Id="2" Name="Second" />
</DataGrid>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="CalculateRow1DescendantBounds" Click="CalculateRow1DescendantBoundsButton_Click" />
<TextBlock Name="Row1Bounds" />
<Button Content="RefreshItems" Click="RefreshDataGridItemsButton_Click" />
</StackPanel>
</Grid>
</Window>