private static void OnVisualStateBehaviorChanged(object sender, DependencyPropertyChangedEventArgs e) { Control control = sender as Control; if (control != null) { VisualStateBehavior newBehavior = (VisualStateBehavior)e.NewValue; if (newBehavior != null) { newBehavior.Attach(control); } } }
public static void SetVisualStateBehavior(DependencyObject obj, VisualStateBehavior value) { Guard.ArgumentNotNull(obj, "obj"); obj.SetValue(VisualStateBehaviorProperty, value); }
/// <summary> /// Applies the specified behavior to all instances of the target /// control type. /// </summary> /// <param name="behavior">The behavior being registered.</param> public static void RegisterBehavior(VisualStateBehavior behavior) { VisualStateBehaviorFactory.RegisterControlBehavior(behavior); }