AllTreeView.xaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:Tree="clr-namespace:Modules.BehaviorTreeModule"
  6. x:Class="Modules.BehaviorTreeModule.AllTreeView"
  7. mc:Ignorable="d"
  8. d:DesignHeight="800"
  9. d:DesignWidth="1280"
  10. d:DataContext="{d:DesignInstance Tree:AllTreeViewModel}">
  11. <DockPanel>
  12. <Menu DockPanel.Dock="Top" Height="24">
  13. <MenuItem Header="File">
  14. <MenuItem Header="打开" Click="MenuItem_Open" />
  15. <MenuItem Header="保存" Click="MenuItem_Save" />
  16. </MenuItem>
  17. </Menu>
  18. <Grid>
  19. <Grid.RowDefinitions>
  20. <RowDefinition/>
  21. <RowDefinition/>
  22. </Grid.RowDefinitions>
  23. <Grid.ColumnDefinitions>
  24. <ColumnDefinition Width="230"/>
  25. <ColumnDefinition Width="Auto"/>
  26. <ColumnDefinition />
  27. </Grid.ColumnDefinitions>
  28. <GroupBox Grid.Row="0" Grid.Column="0" Header="行为树列表:">
  29. <ListBox Name="lbTreeRoots" ItemsSource="{Binding RootList}" VerticalAlignment="Stretch" >
  30. <ListBox.ContextMenu>
  31. <ContextMenu>
  32. <MenuItem Header="新建树" Click="MenuItem_New" />
  33. <MenuItem Header="删除树" Click="MenuItem_Remove" />
  34. </ContextMenu>
  35. </ListBox.ContextMenu>
  36. <ListBox.ItemTemplate>
  37. <DataTemplate DataType="Tree:TreeNodeViewModel">
  38. <StackPanel MouseLeftButtonDown="ListBoxItem_OnMouseLeftButtonDown" MouseLeftButtonUp="ListBoxItem_OnMouseLeftButtonUp"
  39. Orientation="Horizontal" Margin="1,0">
  40. <Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="20"/>
  41. <Label Content="{Binding Comment}" VerticalAlignment="Stretch" Width="150"/>
  42. </StackPanel>
  43. </DataTemplate>
  44. </ListBox.ItemTemplate>
  45. </ListBox>
  46. </GroupBox>
  47. <GroupBox Grid.Row="1" Grid.Column="0" Header="节点编辑:">
  48. <Tree:NodeDataEditor x:Name="nodeDataEditor" VerticalAlignment="Top" />
  49. </GroupBox>
  50. <GridSplitter Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Width="3" ShowsPreview="False" VerticalAlignment="Stretch"
  51. HorizontalAlignment="Stretch" />
  52. <Tree:TreeView x:Name="treeView" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" />
  53. </Grid>
  54. </DockPanel>
  55. </UserControl>