Quantcast
Channel: Digitale Medien » Extension
Viewing all articles
Browse latest Browse all 6

Using a Behavior to magnify your WPF applications

$
0
0

At MIX 2009, the Expression Blend team cam up with a new concept called Behaviors. In fact, the only thing new is the way that the Behaviors are packed. WPF developers have been doing what we called “Attached Behaviors” for quite some time already: see this thread (dated July 2008) to read a discussion around this topic at the WPF Disciples group.

Attached Behaviors leverage a feature of WPF called Attached Properties, that allows you to add a property to an element even if this element doesn’t implement it. When the Attached Property value is set (or changes), you get an access to the element to which the property is attached, and you get a chance to attach an event handler to it, or to modify how it looks, reacts, etc… This is why we call this Attached Behavior. In fact it is similar to extension methods in C#: You define a method somewhere in your code, and you attach it to another element that doesn’t know about it. For more information about attached behaviors, you can read the article that my good friend and fellow WPF Disciple Josh Smith wrote about them.

more here


Viewing all articles
Browse latest Browse all 6

Trending Articles