Hello,
Despite documentation, forum search and the GoXamIntro I have not been able to find out how to get a custom rotation adornment to work. Where do I have to place the template? How do I get the diagram to use my template? How can I place the adornment atop a node instead of right of it?
Also, why does my RotatingTool not rotate the ports with the node? This is what my node template looks like:
<DataTemplate x:Key="ComponentNodeTemplate">
<go:SpotPanel Style="{StaticResource ComponentStyle}"
go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
go:Part.SelectionElementName="VisualComponent"
go:Part.SelectionAdorned="False"
go:Part.LayerName="{Binding Path=Data.Layer.Id}"
go:Part.Visible="{Binding Path=Data.IsVisible}"
go:Part.Selectable="{Binding Path=Data.IsSelectable}"
go:Part.Rotatable="True"
MouseLeftButtonDown="Node_MouseLeftButtonDown"
MouseEnter="Node_MouseEnterComponent"
MouseLeave="Node_MouseLeaveComponent"
Width="{Binding Path=Data.NodeSize.Width}"
Height="{Binding Path=Data.NodeSize.Height}">
<go:NodePanel Sizing="Auto"
go:Node.PortId="Component"
go:SpotPanel.Main="True"
Name="VisualComponent">
<StackPanel>
<Grid Width="{Binding Path=Data.IconSize.Width}"
Height="{Binding Path=Data.IconSize.Height}">
<Image Source="{Binding Path=Data.Icon}"
Stretch="UniformToFill"
HorizontalAlignment="Center"
VerticalAlignment="Center"></Image>
</Grid>
</StackPanel>
</go:NodePanel>
<Ellipse Style="{StaticResource PortStyle}"
Stroke="{Binding Path=Node.Tag, Converter={StaticResource ComponentHoverConverter}}"
go:Node.PortId="1"
go:Node.FromSpot="MiddleBottom"
go:Node.ToSpot="MiddleBottom"
go:SpotPanel.Spot="MiddleTop"
go:SpotPanel.Alignment="MiddleTop" />
<Ellipse Style="{StaticResource PortStyle}"
Stroke="{Binding Path=Node.Tag, Converter={StaticResource ComponentHoverConverter}}"
go:Node.PortId="2"
go:Node.FromSpot="MiddleLeft"
go:Node.ToSpot="MiddleLeft"
go:SpotPanel.Spot="MiddleRight"
go:SpotPanel.Alignment="MiddleRight" />
<Ellipse Style="{StaticResource PortStyle}"
Stroke="{Binding Path=Node.Tag, Converter={StaticResource ComponentHoverConverter}}"
go:Node.PortId="3"
go:Node.FromSpot="MiddleTop"
go:Node.ToSpot="MiddleTop"
go:SpotPanel.Spot="MiddleBottom"
go:SpotPanel.Alignment="MiddleBottom" />
<Ellipse Style="{StaticResource PortStyle}"
Stroke="{Binding Path=Node.Tag, Converter={StaticResource ComponentHoverConverter}}"
go:Node.PortId="4"
go:Node.FromSpot="MiddleRight"
go:Node.ToSpot="MiddleRight"
go:SpotPanel.Spot="MiddleLeft"
go:SpotPanel.Alignment="MiddleLeft" />
</go:SpotPanel>
</DataTemplate>
The rotation adornment template that is supposed to be used is actually just an icon:
<DataTemplate x:Key="RotationAdornmentTemplate">
<Image Source="../Images/rotate.png"></Image>
</DataTemplate>