BehaviorTreeView.xaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <UserControl
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
  7. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  8. xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
  9. x:Class="BehaviorTree.BehaviorTreeView"
  10. mc:Ignorable="d"
  11. d:DesignHeight="600" d:DesignWidth="800">
  12. <UserControl.Resources>
  13. </UserControl.Resources>
  14. <UserControl.CommandBindings>
  15. <CommandBinding Command="ApplicationCommands.New" Executed="NewNode_Executed" />
  16. </UserControl.CommandBindings>
  17. <UserControl.ContextMenu>
  18. <ContextMenu Name="cm">
  19. <MenuItem Header="New Node" Command="ApplicationCommands.New"
  20. CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
  21. </ContextMenu>
  22. </UserControl.ContextMenu>
  23. <Grid>
  24. <ListBox Name="lstTree" ItemsSource="{Binding TreeNodes}" >
  25. <ListBox.ItemsPanel>
  26. <ItemsPanelTemplate>
  27. <Canvas Background="Green"/>
  28. </ItemsPanelTemplate>
  29. </ListBox.ItemsPanel>
  30. <ListBox.ItemContainerStyle>
  31. <Style>
  32. <Setter Property="Canvas.Left" Value="{Binding Mode=TwoWay, Path=X}"/>
  33. <Setter Property="Canvas.Top" Value="{Binding Mode=TwoWay, Path=Y}"/>
  34. </Style>
  35. </ListBox.ItemContainerStyle>
  36. <ListBox.ItemTemplate>
  37. <DataTemplate>
  38. <TextBlock FontWeight="Bold" TextAlignment="Center" Text="Node" />
  39. </DataTemplate>
  40. </ListBox.ItemTemplate>
  41. </ListBox>
  42. </Grid>
  43. </UserControl>