Rotate doesn't work when UserControl is used in DataTemplate

Hi,

I use a DataTemplate for Groups.
In the template, I have a Grid containing all I need for my Group (icon, size).
The Grid container is a go:SpotPanel with the following properties:

  • go:Part.SelectionElementName=“IconGrid”
  • go:Node.Rotatable=“True”
  • go:Node.RotationSpot=“Center”
  • go:Node.RotationAngle="{Binding Path=Data.Angle, Mode=TwoWay}"

So, the actual xaml code is :

<DataTemplate x:Key="MyGroup"> <go:SpotPanel> <go:NodePanel> <Grid x:Name="IconGrid"> //my icon.. </Grid> <TextBlock Text="GroupName" /> </go:NodePanel> </go:SpotPanel> </DataTemplate>

I want to export my Grid in a UserControl because I want to create DependencyProperties.
I just tested to add UserControl tags like this :

<DataTemplate x:Key="MyGroup"> <go:SpotPanel> **<UserControl>** <go:NodePanel> <Grid x:Name="IconGrid" > //my icon.. </Grid> <TextBlock Text="GroupName" /> </go:NodePanel> **</UserControl>** </go:SpotPanel> </DataTemplate>

However, when I add the UserControl tags, selection of rotation does not correctly follow the rotation of the Grid.
I think we can not put a UserControl between SelectionElementName and the container (go:SpotPanel).
If I change my UserControl to StackPanel, it works.

Do you have any idea why the behavior is different with a UserControl?

Thanks,

UserControls “hide” the names of the elements inside them from the outside environment.