Showing posts with label EventTriggers. Show all posts
Showing posts with label EventTriggers. Show all posts

Dock panel like animated buttons in WPF(XAML)

Like dockpanel buttons(Buttons which grows up as mouse enters on button) in windows, we can have the buttons in WPF without writing any C# or VB code. This can be achieved by using EventTriggers & DoubleAnimations.


As mentioned in above image as mouse enters on Recycle Bin icon, it grows up, similar thing can be achieved in wpf, sample XAML is written below.

Code:

WPF: Working with Event Triggers

While an ordinary trigger waits for a property change to occur, an event trigger waits for a specific event to be fired. You might assume that at this point you use setters to change the element, but that’s not the case. Instead, an event trigger requires that you supply a series of actions that modify the control. These actions are used to apply an animation.

Here I am taking a very simple example to explain  how can we use event triggers, Suppose I have a button and a textblock on my window. I want the controls to be grown up when mouse enters and reset as mouse leaves