C# and WPF tutorial files
This commit is contained in:
33
WPF/03-TreeViewsSimpleViewModel/WpfTreeView/MainWindow.xaml
Normal file
33
WPF/03-TreeViewsSimpleViewModel/WpfTreeView/MainWindow.xaml
Normal file
@ -0,0 +1,33 @@
|
||||
<Window x:Class="WpfTreeView.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:WpfTreeView"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="350" Width="525">
|
||||
<Grid>
|
||||
|
||||
<TreeView x:Name="FolderView" ItemsSource="{Binding Items}">
|
||||
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="20" Margin="3"
|
||||
Source="{Binding Type,
|
||||
Converter={x:Static local:HeaderToImageConverter.Instance}}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
|
||||
</TreeView>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
Reference in New Issue
Block a user