Saturday, June 27, 2009 9:38 AM
rudi
Behaviors, Triggers and Actions snippets

I am fortunate to be presenting a session about Expression Blend at Tech-ed Africa 2009 this year. One of the topics I will be covering is how easy it is to create behaviours, triggers and actions using Microsoft.Expression.Interactivity.dll!
Behaviours, triggers and actions is well encapsulated but still require a small amount of repetitive code⦠I created 3 snippets to aid in creating them! Here is the default implementations created using the snippets:
Behavior
/// <summary>
///
/// </summary>
public class MyBehavior : Behavior<FrameworkElement>
{
/// <summary>
///
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
}
/// <summary>
///
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
}
}
Trigger
/// <summary>
///
/// </summary>
public class MyTrigger : TriggerBase<FrameworkElement>
{
/// <summary>
///
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
}
/// <summary>
///
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
}
}
Action
/// <summary>
///
/// </summary>
public class MyAction : TriggerAction<FrameworkElement>
{
/// <summary>
///
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
}
/// <summary>
///
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
}
/// <summary>
///
/// </summary>
/// <param name="parameter"></param>
protected override void Invoke(object parameter)
{
}
}
Download the snippets here
More Information
If you found this interesting or useful please 
Filed under: Blend 3, Trigger, Behavior, Action, Snippets