TreeViewPage.xaml 1.6 KB

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