| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <UserControl
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
- x:Class="BehaviorTree.BehaviorTreeView"
- mc:Ignorable="d"
- d:DesignHeight="600" d:DesignWidth="800">
- <UserControl.Resources>
-
- </UserControl.Resources>
-
- <UserControl.CommandBindings>
- <CommandBinding Command="ApplicationCommands.New" Executed="MenuNewNode_Executed" />
- </UserControl.CommandBindings>
- <UserControl.ContextMenu>
- <ContextMenu>
- <MenuItem Header="New Node" Command="ApplicationCommands.New"
- CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
- </ContextMenu>
- </UserControl.ContextMenu>
- <Grid>
- <ListBox Name="listBox" SelectionMode="Extended" ItemsSource="{Binding TreeNodes}" >
- <ListBox.Resources>
- <Style TargetType="{x:Type ListBoxItem}">
- <Setter Property="Canvas.Left" Value="{Binding Mode=TwoWay, Path=X}"/>
- <Setter Property="Canvas.Top" Value="{Binding Mode=TwoWay, Path=Y}"/>
- </Style>
- </ListBox.Resources>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <Canvas Background="Transparent" AllowDrop="True" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Rectangle Width="50" Height="40" Cursor="Hand" Fill="Green"
- MouseDown="ListBoxItem_MouseDown" MouseUp="ListBoxItem_MouseUp"
- MouseMove="ListBoxItem_MouseMove" />
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </UserControl>
|