The answer I found at: How to rotate an image to a particular angle in Windows Phone 7 Silverlight Application? is close to what I am looking for.
My question is - how can I do this if the image is part of a style? The image is basically an arrow pointing in the direction of movement (track).
<Style x:Key="MyBoatPushPinStyle" TargetType="maps:Pushpin">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Image x:Name="MyBoatIcon"
Source="Resources/Icons/myboat.png"
Stretch="None">
<Image.RenderTransform>
<RotateTransform Angle="0" />
</Image.RenderTransform>
</Image>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The style is applied to a MapLayer:
<maps:MapLayer x:Name="LocationLayer">
<maps:Pushpin Style="{StaticResource MyBoatPushPinStyle}"
Location="{Binding CurrentLocation}" />
</maps:MapLayer>
What I can't figure is how to reference the image within the style, if that can actually be done.
Something like:
((RotateTransform)REFERENCE_TO_IMAGE.RenderTransform).Angle = _currentTrack;