static DionysusTextBox()
    {
        //For the IsReadOnly dependency property
        IsReadOnlyProperty.OverrideMetadata(
            //On the type DionysusTextBox
            typeof(DionysusTextBox),
            //Redefine default behavior
            new FrameworkPropertyMetadata(
                //Default value, can also omit this parameter
                null,
                //When IsReadOnly changed, this is executed
                new PropertyChangedCallback(
                    (dpo, dpce) =>
        {
            //dpo hold the DionysusTextBox instance on which IsReachOnly changed
            //dpce.NewValue hold the new value of IsReadOnly

            //Run logic to set the background here, you are on the UI thread.

            //Example of setting the BorderBrush from ARGB values:
            var dioBox = dpo as DionysusTextBox;
            //Should always be true, of course, it's just my OCD ;)
            if (dioBox != null)
            {
                dioBox.BorderBrush =
                    ColorConverter.ConvertFromString("#FFDDDDDD") as Color;
            }
        })));
    }
 static EditableTextBlock()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(typeof(EditableTextBlock)));
     IsReadOnlyProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(true));
     CursorProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(Cursors.Hand));
     TextProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTextChanged)));
     //FocusableProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(false));
 }
        // ! TextBlock
        public static void Bind(TextBlock tb)
        {
            var textContainer = TextContainerProperty.GetValue(tb);

            var editor = new InternalTextEditorHacker(textContainer, tb, false);

            IsReadOnlyProperty.SetValue(editor._internalTextEditor, true);
            TextViewProperty.SetValue(editor._internalTextEditor, TextContainerTextViewProperty.GetValue(textContainer));
        }
Beispiel #4
0
        /// <summary>
        /// Initializes the <see cref="TextBox"/> type.
        /// </summary>
        static TextBox()
        {
            EventManager.RegisterClassHandler(typeof(TextBox), ScrollViewer.ScrollChangedEvent, new UpfScrollChangedEventHandler(HandleScrollChanged));

            HorizontalScrollBarVisibilityProperty.OverrideMetadata(typeof(TextBox),
                                                                   new PropertyMetadata <ScrollBarVisibility>(ScrollBarVisibility.Hidden, null, CoerceHorizontalScrollBarVisibility));

            IsReadOnlyProperty.OverrideMetadata(typeof(TextBox),
                                                new PropertyMetadata <Boolean>(HandleIsReadOnlyChanged));
        }
Beispiel #5
0
        static SearchBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(typeof(SearchBox)));

            KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));

            IsEditableProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(true));
            IsReadOnlyProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(false));
            ShouldPreserveUserEnteredPrefixProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(true));
            StaysOpenOnEditProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(true));
            IsTabStopProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(false));

            IsDropDownOpenProperty.OverrideMetadata(typeof(SearchBox), new FrameworkPropertyMetadata(OnIsDropDownOpenChanged));
        }
Beispiel #6
0
 /// <summary>
 /// スタティックコンストラクタ
 /// </summary>
 static ExTextBox()
 {
     //依存関係プロパティのメタデータのオーバーライド
     //IsReadOnlyプロパティが変更された時の動作
     IsReadOnlyProperty.OverrideMetadata(
         typeof(ExTextBox)
         , new FrameworkPropertyMetadata(
             false
             , (sender, e) =>
     {
         ExTextBox textBox = sender as ExTextBox;
         if (textBox == null)
         {
             return;
         }
         MessageBox.Show(textBox.IsReadOnly.ToString());
     }));
 }
Beispiel #7
0
    static DionysusTextBox()
    {
        //For the IsReadOnly dependency property
        IsReadOnlyProperty.OverrideMetadata(
            //On the type DionysusTextBox
            typeof(DionysusTextBox),
            //Redefine default behavior
            new FrameworkPropertyMetadata(
                //Default value, can also omit this parameter
                null,
                //When IsReadOnly changed, this is executed
                new PropertyChangedCallback(
                    (dpo, dpce) =>
        {
            //dpo hold the DionysusTextBox instance on which IsReachOnly changed
            //dpce.NewValue hold the new value of IsReadOnly

            //Run logic to set the background here, you are on the UI thread.
        })));
    }
 set => SetValue(IsReadOnlyProperty, value);
Beispiel #9
0
 static TextBox()
 {
     IsReadOnlyProperty.AddPropertyChangeCallback(IsReadOnlyChanged);
     TextProperty.AddPropertyChangeCallback(TextPropertyChanged);
 }
Beispiel #10
0
 static SmartGrid()
 {
     IsReadOnlyProperty.OverrideMetadata(typeof(SmartGrid), new FrameworkPropertyMetadata((o, e) => ((SmartGrid)o).ConfigureColumns()));
     CommandManager.RegisterClassCommandBinding(typeof(SmartGrid), new CommandBinding(ApplicationCommands.Paste, (o, e) => ((SmartGrid)o).OnExecutedPaste()));
 }
Beispiel #11
0
 /// <summary>
 /// Constructor</summary>
 static FormattingTextBox()
 {
     IsReadOnlyProperty.OverrideMetadata(typeof(FormattingTextBox),
                                         new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits, IsReadOnlyChanged));
 }
Beispiel #12
0
 set => this.SetValue(IsReadOnlyProperty, value);