Welcome to MSDN Blogs Sign in | Join | Help

Top Ten UI Development Breakthroughs In Windows Presentation Foundation

Here is an interesting article presenting some of the cool WinFx features:
Top Ten UI Development Breakthroughs In Windows Presentation Foundation
Published Thursday, February 23, 2006 2:17 AM by adrianvinca

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Top Ten UI Development Breakthroughs In Windows Presentation Foundation

Wednesday, February 22, 2006 11:09 PM by vgrigoriu
What's the difference between triggers and good ol' fashioned events?

# re: Top Ten UI Development Breakthroughs In Windows Presentation Foundation

Thursday, February 23, 2006 3:14 PM by adrianvinca
Hi Victor,

IMHO, triggers allow a declarative way (in the xaml) of implementing some conditional behaviors. This brings some advantages: toolability (e.g. see how Expression Interactive Designer displays the triggers) and improves the reusability (if you want to reuse your styled control into another project, you just need to copy the xaml). There are also different types of triggers:

EventTrigger - A class that controls a set of actions to activate in response to an event

DataTrigger - A single Style data conditional dependency driver (this one is very useful when combined with databinding)

Trigger - represents a condition for a property value that, when met, causes the associated Setter to change a property value.

Thanks,
- Adrian

# re: Top Ten UI Development Breakthroughs In Windows Presentation Foundation

Thursday, February 23, 2006 6:39 PM by vgrigoriu
I don't see how using declarative syntax (and don't get me started on how this doesn't add anything new to the programming experience) makes triggers different from events (which they really are under the hood, right?).
And re: "you just need to copy the xaml": so I can have duplicate code instead of using a dll / assembly or whatever they call it these days? No thanks :)

# re: Top Ten UI Development Breakthroughs In Windows Presentation Foundation

Thursday, February 23, 2006 7:45 PM by adrianvinca
First of all, triggers don't replace the events. You can still use events and code behind for your controls (and for more complicated operations, using triggers could be difficult or even impossible).

"Copy the xaml" wasn't perhaps the best way to express the fact that reusability could be a little bit easier. Just like in an HTML you can create a style for a button, in Windows Presentation Foundation you can create a style and reuse it across your controls. The Windows Presentation Foundation offers ways to reuse the source without copying the code (you can use resource dictionaries) or you can use assemblies.

A similar question was posted on the Windows Presentation Foundation forums (you may want to check there for other opinions): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=264517&SiteID=1

You could also check the tutorial "Creating a simple style with one trigger" to see how Expression Interactive Designer allows creating triggers and how you can switch between different states and visualize the behavior (e.g. you click on the IsMouseOver state and see how your control looks like when the mouse is over).

Thanks,
- Adrian

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker