D
D
Dmitry Afonchenko2015-11-09 17:27:33
WPF
Dmitry Afonchenko, 2015-11-09 17:27:33

How to make sure that you do not rewrite the trigger for different WPF elements?

There is such a trigger that changes the color of the rectangle during the OnMouseEnter and OnMouseLeave events:

<Rectangle.Triggers>
                <EventTrigger RoutedEvent="Button.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation To="Black" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)" FillBehavior="HoldEnd" Duration="0:0:0.5"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="Button.MouseLeave">
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation To="#CC001774" Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)" FillBehavior="HoldEnd" Duration="0:0:0.5"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Rectangle.Triggers>

Is there another rectangle that behaves the same way, without rewriting the same trigger for it, do the same processing on it? Please do not scold too much, because I'm still a complete newbie. Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question