Hi,
I have done some code that uses the RotationTool. Everything works fine until I try to create a node with a different angle value than 0°.
When I do rotation nodes after creating them with a default Angle value of 0, I’m getting this, which is exactly what I want :
But if I serialize/deserialize those nodes, I do create nodes whit angle value different than 0, so I’m getting this :
Here is the code I use :
<DataTemplate x:Key="Mixer"> <go:SpotPanel go:Part.SelectionAdorned="True" Visibility="{Binding Data.IsVisible, Converter={StaticResource boolToVisibilityConverter}}" go:Node.Location="{Binding Data.Location, Mode=TwoWay}" ToolTip="{Binding Data.Id}" go:Node.SelectionElementName="NodePanel" go:Node.RotationAngle="{Binding Data.Angle, Mode=TwoWay}" go:Part.Rotatable="True" go:Part.RotateAdornmentTemplate="{StaticResource NodeRotateAdornmentTemplate}" > <go:SpotPanel.InputBindings> <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Data.ShowEditorCommand}"/> </go:SpotPanel.InputBindings> <StackPanel> <go:NodePanel x:Name="NodePanel" Background="Transparent" Cursor="ScrollAll"> <Grid Width="40" Height="40"> <Path x:Name="RotatableItem" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="28" Panel.ZIndex="2" Stretch="Fill" Fill="Transparent" Data="F1 M 236.285,736L 211.715,752L 211.715,720L 236.285,736 Z " go:Node.PortId="" go:Node.LinkableFrom="True" go:Node.LinkableTo="True" go:Node.ToSpot="LeftSide" go:Node.FromSpot="RightSide" Cursor="Hand"/> <ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="28" Panel.ZIndex="1" Template="{StaticResource MixerIcon}" /> </Grid> </go:NodePanel> <TextBlock Style="{StaticResource TextBlockUnityNameStyle}" /> </StackPanel> </go:SpotPanel> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Data.Angle}" Value="0"> <Setter Property="go:Node.ToSpot" TargetName="RotatableItem" Value="LeftSide"/> <Setter Property="go:Node.FromSpot" TargetName="RotatableItem" Value="RightSide"/> </DataTrigger> <DataTrigger Binding="{Binding Data.Angle}" Value="360"> <Setter Property="go:Node.ToSpot" TargetName="RotatableItem" Value="LeftSide"/> <Setter Property="go:Node.FromSpot" TargetName="RotatableItem" Value="RightSide"/> </DataTrigger> <DataTrigger Binding="{Binding Data.Angle}" Value="90"> <Setter Property="go:Node.ToSpot" TargetName="RotatableItem" Value="TopSide"/> <Setter Property="go:Node.FromSpot" TargetName="RotatableItem" Value="BottomSide"/> </DataTrigger> <DataTrigger Binding="{Binding Data.Angle}" Value="180"> <Setter Property="go:Node.ToSpot" TargetName="RotatableItem" Value="RightSide"/> <Setter Property="go:Node.FromSpot" TargetName="RotatableItem" Value="LeftSide"/> </DataTrigger> <DataTrigger Binding="{Binding Data.Angle}" Value="270"> <Setter Property="go:Node.ToSpot" TargetName="RotatableItem" Value="BottomSide"/> <Setter Property="go:Node.FromSpot" TargetName="RotatableItem" Value="TopSide"/> </DataTrigger> </DataTemplate.Triggers> </DataTemplate>
Is this look alright ? What may I have missed ?
Thanks,
Mathieu