I'm try to change the style of a user control based on a local property. I've tried using dependency properties and implementing INotifyPropertyChanged but nothing is working. I'm new to WPF so I'm hoping it is something simple. Thanks for your help.
Style located in the ResourceDictionary of the user control .xaml file. If you remove the datatrigger the effect is applied correctly.
<Style x:Name="Showing" TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsShowing}" Value="True">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0"
Color="Orange"
Opacity="1"
BlurRadius="1"
Direction="100"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
The PropertyChanged event is getting raised when the property changes.
Public Class ucLCGPulseWindowMini
Implements INotifyPropertyChanged
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Public Shadows Sub OnPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
If Not e Is Nothing Then
RaiseEvent PropertyChanged(Me, e)
End If
End Sub
Private blnShowing As Boolean = False
Public Property IsShowing() As Boolean
Get
Return blnShowing
End Get
Set(ByVal value As Boolean)
blnShowing = value
OnPropertyChanged(Me, New PropertyChangedEventArgs("IsShowing"))
End Set
End Property
After setting the IsShowing property to True at runtime, I can look at the border element in WPF Inspector and it sees the trigger but says IsShowing == True Value{x:Null}
. However, if I look at the instance of the user control in WPF inspector it shows IsShowing = True