I\'m trying to get some WPF concepts down, so I\'ve put together a simple example of what I\'m trying to do. I would like to set a custom property of a user control, and hav
You set up a dependency property like this:
Public Shared ReadOnly MouseOverBrushProperty As DependencyProperty = DependencyProperty.Register("MouseOverBrush", GetType(Brush), GetType(BrushableComboBox), New UIPropertyMetadata())
Public Property MouseOverBrush() As Brush
Get
Return CType(GetValue(MouseOverBrushProperty), Brush)
End Get
Set(ByVal value As Brush)
SetValue(MouseOverBrushProperty, value)
End Set
End Property
And then in your xaml you do something like this
Background="{TemplateBinding MouseOverBrush}"
and you can set a default style outside of the control template like this: