misc: add binding demo.

This commit is contained in:
rabbitism
2023-05-26 20:18:43 +08:00
parent 5d8297a392
commit 9d17cd0087
2 changed files with 43 additions and 2 deletions

View File

@@ -4,10 +4,13 @@
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:vm="clr-namespace:Semi.Avalonia.Demo.Pages"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:TreeViewVm"
mc:Ignorable="d">
<Panel HorizontalAlignment="Left">
<StackPanel HorizontalAlignment="Left">
<TreeView>
<TreeViewItem Header="Level 1">
<TreeViewItem Header="Level 2" />
@@ -42,5 +45,12 @@
</TreeViewItem>
</TreeViewItem>
</TreeView>
</Panel>
<TreeView ItemsSource="{Binding Items}">
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Items}">
<TextBlock Text="{Binding Name}" />
</TreeDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</StackPanel>
</UserControl>