-
Notifications
You must be signed in to change notification settings - Fork 90
/
TreeViewHelperPage.xaml
41 lines (38 loc) · 1.63 KB
/
TreeViewHelperPage.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
<Page x:Class="PixelLab.Wpf.Demo.TreeViewHelperPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tvh="http://schemas.thinkpixellab.com/2011/xaml/presentation">
<Page.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3"/>
</Style>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button Content="Expand by objects"/>
<Button Content="Expand by indices"/>
<Button Content="Expand All"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="1">
<Button Content="Expand All (via data)"/>
<Button Content="Refresh data"/>
</StackPanel>
<TreeView Name="treeView" Grid.Row="2">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Children}">
<ContentPresenter Content="{Binding Path=Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</Page>