I'm trying to create a custom control that can be shared by both Silverlight and WPF. For the sake of this I don't use Triggers in my Custom control's templates which are not supported by Silverlight - instead I use Storyboard animations which seem to be supported by both platforms.
First, I made a Custom control which works well for Silverlight. Then tried to use it in WPF and kept getting the following runtime error: Property path is not valid. 'Shape' does not have a public property named 'Background'.
The following XAML in my Custom control template is the cause:
<VisualState x:Name="Hovered">
<Storyboard>
<ColorAnimation Duration="0:0:0"
Storyboard.TargetName="PBorder"
Storyboard.TargetProperty="(Shape.Background).(SolidColorBrush.Color)" To="White" />
</Storyboard>
</VisualState>
What is the valid XAML syntax for this part of code for WPF specifically?
And is it possible to make this XAML valid for both Silverlight and WPF?