I am adding a trigger to a custom Datepicker to trigger a popup textblock.
However, when i run the code, i get an unhandled nullreferenceexception.
if i remove the trigger, everything works fine.
<Grid.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Popup_PrevButton" Property="IsOpen" Value="True" />
<Setter TargetName="Popup_NextButton" Property="IsOpen" Value="True" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter TargetName="Popup_PrevButton" Property="IsOpen" Value="False" />
<Setter TargetName="Popup_NextButton" Property="IsOpen" Value="False" />
</Trigger>
</Grid.Triggers>
I have tried placing the trigger in the PART_Button and ControlTemplate but nothing works.
The popup code is placed right after the PART_Popup and is as follows:
<Popup x:Name="Popup_PrevButton"
PlacementTarget="{Binding ElementName=PART_Button}"
IsOpen="False"
Placement="Left"
StaysOpen="False"
AllowsTransparency="True"
PopupAnimation="Fade"
Focusable="True">
<StackPanel>
<Border Background="LightYellow">
<TextBlock>Show Custom Rext</TextBlock>
</Border>
</StackPanel>
</Popup>
what is giving the error?
Triggers of an element only support
EventTriggerso you can’t use property triggers (Trigger). LookFrameworkElement.TriggersProperty.