Esempio n. 1
0
        private static void OnSetCustomCommandParameterCallback(DependencyObject dep,
                                                                DependencyPropertyChangedEventArgs e)
        {
            var textBox = dep as TextBox;

            if (textBox != null)
            {
                TextBoxTextChangedCommandBehavior behavior = GetOrCreateTextBoxBehavior(textBox);
                behavior.CommandParameter = e.NewValue;
            }
        }
Esempio n. 2
0
        private static TextBoxTextChangedCommandBehavior GetOrCreateTextBoxBehavior(TextBox textBox)
        {
            var behavior = textBox.GetValue(TextChangedCommandBehaviorProperty) as TextBoxTextChangedCommandBehavior;

            if (behavior == null)
            {
                behavior = new TextBoxTextChangedCommandBehavior(textBox);
                textBox.SetValue(TextChangedCommandBehaviorProperty, behavior);
            }

            return(behavior);
        }