Skip to main content

Posts

Showing posts from January, 2010

Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – Part 2 – Triggers

The objective of this article series is to give a quick overview of Behaviors, Triggers and Actions in Silverlight and WPF.  Together, they enable a great deal of design time interactivity for your UI. They also make possible re-use and re-distribution of interaction logic. This is the second article in the series, and I’ll explain about Triggers and Actions. Also, we’ll explore how to create custom triggers.Part I - Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – BehaviorsPart II - Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – Triggers (this one) Note: You need Expression Blend 4.0The completed source code for this exercise is availableDownload hereTriggers and Actions – Scratching the SurfaceA Trigger can invoke a set of Actions, when it is fired. For example, you can nest few actions (like PropertyChangeAction to change a property of an element) in an EventTrigger, so that those actions will get executed when a specific Event occurs. You …

Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – Part I - Behaviors

The objective of this article series is to give a quick overview of Behaviors, Triggers and Actions in Silverlight and WPF. Together, they enable a great deal of design time interactivity for your UI. They also make possible re-use and re-distribution of interaction logic. This is the first article in the series, and I’ll explain about Behaviors and creating custom behaviors.Part I - Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – Behaviors (this one) Part II - Behaviors, Triggers and Actions in Silverlight And WPF Made Simple – TriggersNote: You need Expression Blend 4.0Note: Why this post? After publishing my Silverlight and WPF interaction frameworks, Silverlight Experimental Hacks (Slex)and WPF Experimental Hacks (Wex), I got a number of requests from the community to write few simple posts on these topics, introducing the basic concepts. So here we go.Behaviors – Scratching the SurfaceA behavior is something you attach to an element, modifying the way how the…

WPF Extensibility Hacks – Preview 1 – Few interesting Triggers and Actions for WPF, Invoking Triggers based on Conditions etc

Download Source HereSome time back, I posted about the Silverlight Extensibility hacks Preview 2.0. I did a quick port of the code base to WPF under the name WEX or WPF Extensibility hacks, and now you have the goodness in .NET 3.5 + VS 2008Just want to have a quick word on what is available. Here are a couple of points about Wex. Wex is built on top of System.Windows.Interactivity infrastructure.Wex allows you to define multiple conditions for invoking triggers (like you can specify a KeyDown event trigger should be fired only if ‘A’ is pressed) You can specify multiple conditions for invoking each action in a trigger Wex introduces few more Triggers and Actions that you’ll see soon. As of now, Wex Preview 1 Provides the following TriggersEventTrigger – Will be fired when an event is raised. Can listen to events of Elements, or events from your view model ReactiveTrigger – Can ‘import’ an Observable that you may ‘export’ using MEF. Useful to define and use custom events using System.…

Silverlight Powered Wearable Locket

Can I have a call with all the Project Natal, Win Mob and Silverlight guys to tell them, “Guys, let us get this thing out by next month”?

A Silverlight helper class to get/set Dependency property values of other objects

In my last post on Dependency Properties (Read here), I explained how to  listen for dependency property change notification of a UI Element. Here is a more ‘refined’ extension method - so that you can listen to Property change notifications of a source - by creating and registering a ‘listener’ dependency property in your class ('owner') and setting up a binding with the ‘source’ object. Remember that starting from Silverlight 4.0, you can even have dependency objects as the source.This is useful when you create your own Silverlight Behaviors, triggers or actions. For example, you may want to listen to the property change notification of an element - to Invoke your trigger when the property value of the ‘source’ changes. public static class DependencyPropertyHelper { /// <summary> /// Listen for change of a property of the source, /// and callback the same to the context via the callback /// </summary> public stati…