We have a requirement in our application, to change the style of the WpfMap. Specifically we've created a control derived from WpfMap and want to add a few bells and whistles to it.
To do this normally, you would create a WPF CustomControl in Visual Studio and change the derived class from Control to the control you want to extend. In this case ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.
If you want to 'borrow' the Style and ControlTemplate (which we should), you can create a Copy of the default style by using Expression Blend. This is the default template for WpfMap as ascertained by Blend:-
Style TargetType="{x:Type myControls:MyWpfMap}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type myControls:MyWpfMap}">
<Canvas x:Name="WpfMapCanvas">
Background="Transparent">
<Canvas x:Name="OverlayCanvas">
<Canvas.Resources>
<Storyboard x:Key="ZoomStoryboard"
Duration="0:0:0.45">
<DoubleAnimation Duration="0:0:0.35"
Storyboard.TargetProperty="ScaleX"
Storyboard.TargetName="ZoomTransform" />
<DoubleAnimation Duration="0:0:0.35"
Storyboard.TargetProperty="ScaleY"
Storyboard.TargetName="ZoomTransform" />
</Storyboard>
<Canvas.RenderTransform>
<ScaleTransform />
</Canvas>
</Canvas>
<Grid x:Name="ToolsGrid" />
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
Style>
Here's where the problem is... If you make sure this style is applied implicity and run the application, you'll see that the new control is rendered properly. However, when you try to zoom in and out, you're hit with an exception
Cannot set a property on object 'System.Windows.Media.ScaleTransform' because it is in a read-only state.
Can anyone shed any light on this problem?