Exemple #1
0
        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);
                }
            }
        }
 /// <summary>
 ///     Sets the value of the VisualStateBehavior attached property.
 ///     Setting the value will attach the behavior to the instance of the control.
 /// </summary>
 public static void SetVisualStateBehavior(DependencyObject obj, VisualStateBehavior value)
 {
     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);
 }
Exemple #4
0
 /// <summary>
 ///     Sets the value of the VisualStateBehavior attached property.
 ///     Setting the value will attach the behavior to the instance of the control.
 /// </summary>
 public static void SetVisualStateBehavior(DependencyObject obj, VisualStateBehavior value)
 {
     obj.SetValue(VisualStateBehaviorProperty, value);
 }
Exemple #5
0
 /// <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);
 }