Пример #1
0
        public static object IsEditingCoerce(DependencyObject s, object v)
        {
            EditBox eb = (EditBox)s;

            if (!eb.IsEditable)
            {
                return(false);
            }
            return(v);
        }
Пример #2
0
        public EditBoxAdorner(EditBox editBox, UIElement adornedElement)
            : base(adornedElement)
        {
            _editBox        = editBox;
            _visualChildren = new VisualCollection(this);
            BuildTextBox();

            #region Block Enter command

            enterCommandBinding = new CommandBinding(ApplicationCommands.Open,
                                                     (ExecutedRoutedEventHandler) delegate(object sender, ExecutedRoutedEventArgs e)
            {
                e.Handled = true;
            },
                                                     (CanExecuteRoutedEventHandler) delegate(object sender, CanExecuteRoutedEventArgs e)
            {
                e.CanExecute = true;
            });
            CommandManager.RegisterClassCommandBinding(typeof(EditBoxAdorner), enterCommandBinding);
            //CommandManager.RegisterClassInputBinding(typeof(EditBoxAdorner), new InputBinding(ApplicationCommands.Open, new KeyGesture(Key.Enter)));
            #endregion
        }
Пример #3
0
        public static void IsEditingChanged(DependencyObject s, DependencyPropertyChangedEventArgs e)
        {
            EditBox eb = (EditBox)s;

            eb._adorner.UpdateVisibilty((bool)e.NewValue);
        }