I’m having a problem with creating my styles for a custom wpf class.
This is what I have…
I have a class called FalconToggleButton that inherits System.Windows.Controls.Primitives.ToggleButton
FalconToggleButton has a new custom property called:
Public Property ButtonHoverIcon As System.Uri
FalconToggleButton also has other similar new methods and properties.
When I use the class I have no problems with it, when other classes inherit it they can use ButtonHoverIcon when they are defined through xaml or through code.
The problem happens when I try to make a style for FalconToggleButton
<Style x:Key="ToolBarMenuItemStyleDefault" TargetType="{x:Type DrawControl:FalconToggleButton}" BasedOn="{x:Null}">
<Setter Property= "ButtonOffIcon" Value="pack://application:,,,/Images/WaitIcon.png"/>
</Style>
Property= “ButtonOffIcon” is not recognized as a valid property
When I run the code I get a generic
“XamlParseException occurred” message:
‘Set property ‘System.Windows.Setter.Property’ threw an exception.’ Line number ’12’ and line position ’10’.
Do I need to register something somewhere to get my properties to show up in the styles structures?
Any help would be appreciated,
MS
You have to register your property as DependencyProperty.