<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I tried creating a quick palette, such that user could quickly add items to the current node in addition be able to drag and drop items from the node to where he/she desires. I looked at the State example.
Here are my results and questions...
1) Sometimes I try to select an item I get multi selection adorner instead of drag and drop. I selected the green circle but instead of dragging the selection tool is shown. Any suggestion on how to fix this?
2) By placing the diagram tool inside the Template it changes the nodes width and height. Is there a way to not have this happen? * The gray area background is the spot panel’s new area.
3) When I move an item from the palette, I would like it to be connected to the from node just like in the State example. Can this be done?
4) Is there another way to create a quick palette that supports drag and click to create and link elements?
Thank you,
Pavel
Source for QuickPalette user control.
<UserControl …>
<go:Palette x:Name="quickPalette"
AllowDragOut="True"
AllowResize="False"
Background="Gray"
MaximumSelectionCount="1"
NodeTemplateDictionary="{StaticResource NodeTemplateDictionary}"
Style="{StaticResource PaletteStyle1}">
<go:Diagram.LayoutManager>
<go:LayoutManager Animated="False" />
</go:Diagram.LayoutManager>
<go:Palette.Layout>
<golayout:GridLayout WrappingWidth="300"
Sorting="Forward" />
</go:Palette.Layout>
</go:Palette>
</UserControl>
Source for my node template
<DataTemplate x:Key="IntermediateNodeTemplate">
<go:SpotPanel x:Name="spotPanel"
go:Node.Location="{Binding Data.Location, Mode=TwoWay}"
go:Node.LocationSpot="BottomLeft"
go:Part.SelectionElementName="selectableArea"
MouseRightButtonDown="part_MouseRightButtonDown"
MouseRightButtonUp="part_MouseRightButtonUp"
MouseEnter="Node_MouseEnter"
MouseLeave="Node_MouseLeave">
<go:NodePanel Sizing="Fixed">
<Path x:Name="selectableArea"
go:NodePanel.Figure="Circle"
Height="{Binding Data.Height, Mode=TwoWay}"
Width="{Binding Data.Width, Mode=TwoWay}"
Fill="{StaticResource theOrangeBrush}"
Stroke="Gray" />
<TextBlock Text="{Binding Data.Key}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
go:Part.TextEditable="True"
MinWidth="10"
MinHeight="10" />
</go:NodePanel>
<view:QuickPaletteView go:SpotPanel.Spot="0.5 0 0 -30"
go:SpotPanel.Alignment="TopCenter" />