TreeViewPage.xaml 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.TreeViewPage">
  4. <StackPanel Orientation="Vertical" Spacing="4">
  5. <TextBlock Classes="h1">TreeView</TextBlock>
  6. <TextBlock Classes="h2">Displays a hierachical tree of data.</TextBlock>
  7. <StackPanel Orientation="Horizontal"
  8. Margin="0,16,0,0"
  9. HorizontalAlignment="Center"
  10. Spacing="16">
  11. <StackPanel Orientation="Vertical" Spacing="8">
  12. <TreeView Items="{Binding Items}" Selection="{Binding Selection}" SelectionMode="{Binding SelectionMode}" Width="250" Height="350">
  13. <TreeView.ItemTemplate>
  14. <TreeDataTemplate ItemsSource="{Binding Children}">
  15. <TextBlock Text="{Binding Header}"/>
  16. </TreeDataTemplate>
  17. </TreeView.ItemTemplate>
  18. </TreeView>
  19. <Button Command="{Binding AddItemCommand}">Add</Button>
  20. <Button Command="{Binding RemoveItemCommand}">Remove</Button>
  21. <ComboBox SelectedIndex="{Binding SelectionMode, Mode=TwoWay}">
  22. <ComboBoxItem>Single</ComboBoxItem>
  23. <ComboBoxItem>Multiple</ComboBoxItem>
  24. <ComboBoxItem>Toggle</ComboBoxItem>
  25. <ComboBoxItem>AlwaysSelected</ComboBoxItem>
  26. </ComboBox>
  27. </StackPanel>
  28. </StackPanel>
  29. </StackPanel>
  30. </UserControl>