Ejemplo n.º 1
0
        private static void CommandProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            TextBox element = dependencyObject as TextBox;

            if (element != null)
            {
                TextChangedBehavior behavior = GetOrCreateBehavior(element);
                behavior.Command = e.NewValue as ICommand;
            }
        }
Ejemplo n.º 2
0
        private static TextChangedBehavior GetOrCreateBehavior(TextBox element)
        {
            TextChangedBehavior behavior = element.GetValue(TextChangedBehaviourProperty) as TextChangedBehavior;

            if (behavior == null)
            {
                behavior = new TextChangedBehavior(element);
                element.SetValue(TextChangedBehaviourProperty, behavior);
            }

            return(behavior);
        }
Ejemplo n.º 3
0
 public static void SetTextChangedCommandBehavior(DependencyObject obj,
                                                  TextChangedBehavior value)
 {
     obj.SetValue(TextChangedBehaviourProperty, value);
 }