Hello,
I have a little problem and I don't know how can I fix it ...
I created a CustomControl called "StandardKeyView" from a Button. This control has a dependency property "DownImage" which is used to define a Background Image to my control during the mouse over.
Here's the definition of the DownImage property :
public SolidColorBrush DownImage
{
get { return (SolidColorBrush)GetValue( DownImageProperty ); }
set { SetValue( DownImageProperty, value ); }
}
public static readonly DependencyProperty DownImageProperty =
DependencyProperty.Register( "DownImage", typeof( SolidColorBrush ), typeof( StandardKeyView ) );
Here's the definition of a new StandardKeyView :
<skv:StandardKeyView Background="White" DownImage="Black"/>
Here's the default control template of a StandardKeyView :
<ControlTemplate TargetType="{x:Type skv:StandardKeyView}" x:Key="DefaultStandardKeyViewTemplate">
<Button Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" x:Name="MainButton" />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="MainButton" Property="Background" Value="{TemplateBinding Property=DownImage}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
I think it should work fine, but not really. I have a weird error : when I try to start the application, I have a XamlParseException who said
Unable to convert the value of attribute 'Value' as an object of type ''.
I think the type of DownImage is good, then why doesn't it work when it used in the trigger?