-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
41 lines (39 loc) · 1.58 KB
/
MainWindow.xaml
File metadata and controls
41 lines (39 loc) · 1.58 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
<Window x:Class="TreeTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TreeTest"
Title="MainWindow"
Width="525"
Height="350">
<Window.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:Category}" ItemsSource="{Binding Path=Products}">
<TextBlock Text="{Binding Path=CategoryName}" />
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:Product}" ItemsSource="{Binding Path=Parts}">
<StackPanel Orientation="Horizontal">
<Rectangle Width="10"
Height="10"
Fill="Green" />
<TextBlock Foreground="Green" Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:Part}">
<TextBlock Foreground="Red" Text="{Binding Path=Name}" />
</HierarchicalDataTemplate>
</Window.Resources>
<Grid>
<TreeView Name="tv"
Width="120"
Margin="6"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
<Button Name="cndAdd"
Width="75"
Height="23"
Margin="386,75,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="cndAdd_Click"
Content="Add" />
</Grid>
</Window>