I have Labelone that I am trying to change an event MouseDownif the user is registered or not using Trigger.
<Label x:Name="lblSave" MouseDown="lblSave_MouseDown" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" ToolTip="Save Files" Width="25" Height="25" Margin="0, 0, 5, 0" >
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Background" Value="{DynamicResource ResourceKey=saveIcon}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static sec:Security.Instance}, Path=IsLoggedIn}" Value="False">
<Setter Property="Background" Value="{DynamicResource ResourceKey=readonlyIcon}" />
<EventSetter Event="MouseDown" Handler="lblNoAccess_MouseDown" />
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
But, contrary to this mail, I will not work because it is MouseDownnot a routable event. I still get the error System.Windows.EventSetter.Event: {"Value cannot be null.\r\nParameter name: value"}.
So my question is: is there a way to use a trigger to set non-forwarded events?
source
share