Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

XAML / Persisting property value set by Event.Trigger

$
0
0

Hello,

I suspect that there is something fundamental that I am overlooking, here...

As soon as the mouse moves off of the label, subsequent to the Event.Trigger having changed it to Red, (See pasted markup, below.) the foreground returns to PowderBlue.

How would I get the default of PowderBlue, but also get the Red to persist, subsequent to MouseUp, and the cursor moving off the label?

Thank you in advance, for your assistance.

   <Style x:Key="Style" TargetType="{x:Type Label}">
    <Setter Property="Foreground" Value="PowderBlue"/>

    ...

    <Style.Triggers>
        <EventTrigger RoutedEvent="MouseUp" >
            <EventTrigger.Actions>
                <BeginStoryboard >
                    <Storyboard >
                        <ColorAnimation Storyboard.TargetProperty="(Foreground).Color" To="Red"  Duration="0:0:1" AutoReverse="False" FillBehavior="HoldEnd" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger.Actions>
        </EventTrigger>
    </Style.Triggers>

    ...


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>