Exemplo n.º 1
0
 static NumericTextBox()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(NumericTextBox), new FrameworkPropertyMetadata(typeof(NumericTextBox)));
     TextProperty.OverrideMetadata(typeof(NumericTextBox), new FrameworkPropertyMetadata()
     {
         DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
     });
 }
Exemplo n.º 2
0
        static WaterBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(WaterBox),
                                                     new FrameworkPropertyMetadata(typeof(WaterBox)));

            TextProperty.OverrideMetadata(typeof(WaterBox),
                                          new FrameworkPropertyMetadata(TextPropertyChanged));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the <see cref="MaskedTextBox" /> class.
        /// </summary>
        static MaskedTextBox()
        {
            var metaData = new FrameworkPropertyMetadata {
                CoerceValueCallback = CoerceTextValueCallback
            };

            TextProperty.OverrideMetadata(typeof(MaskedTextBox), metaData);
        }
        /// <summary>
        /// Shared constructor initializes look and behavior
        /// </summary>
        static DelcamTextBox()
        {
            //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
            //This style is defined in themes\generic.xaml
            DefaultStyleKeyProperty.OverrideMetadata(typeof(DelcamTextBox), new FrameworkPropertyMetadata(typeof(DelcamTextBox)));

            TextProperty.OverrideMetadata(typeof(DelcamTextBox), new FrameworkPropertyMetadata(TextPropertyChanged));
        }
Exemplo n.º 5
0
        static InfoTextBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(InfoTextBox), new FrameworkPropertyMetadata(typeof(InfoTextBox)));

            TextProperty.OverrideMetadata(
                typeof(InfoTextBox),
                new FrameworkPropertyMetadata(new PropertyChangedCallback(TextPropertyChanged)));
        }
        static CnDTimeInputTextBox()
        {
            //override the meta data for the Text Property of the textbox
            var metaData = new FrameworkPropertyMetadata();

            metaData.CoerceValueCallback = CoerceValueCallback;
            TextProperty.OverrideMetadata(typeof(CnDTimeInputTextBox), metaData);
        }//force the text of the control to use the mask
Exemplo n.º 7
0
        /// <summary>
        /// Static Constructor
        /// </summary>
        static MaskedTextBox()
        {
            //override the meta data for the Text Proeprty of the textbox
            FrameworkPropertyMetadata metaData = new FrameworkPropertyMetadata();

            metaData.CoerceValueCallback = ForceText;
            TextProperty.OverrideMetadata(typeof(MaskedTextBox), metaData);
        }
Exemplo n.º 8
0
 static TextBoxExt()
 {
     TextProperty.OverrideMetadata(
         typeof(TextBoxExt),
         new FrameworkPropertyMetadata(default(string))
     {
         DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
     });
 }
Exemplo n.º 9
0
 static SafeSqlTextBox()
 {
     TextProperty.OverrideMetadata(typeof(SafeSqlTextBox),
                                   new FrameworkPropertyMetadata(
                                       new PropertyChangedCallback(TextPropertyChangedCallBack),
                                       new CoerceValueCallback(TextPropertyCoerceValueCallback)
                                       )
                                   );
 }
Exemplo n.º 10
0
 static partial void StaticConstructorImplementation()
 {
     TextProperty.OverrideMetadata(
         typeof(MessageTextBox),
         new FrameworkPropertyMetadata(
             String.Empty,
             null,
             new CoerceValueCallback(OnTextBoxTextCoerce)));
 }
Exemplo n.º 11
0
        static ConsoleTextBox()
        {
            var oldTextMetadata = TextProperty.GetMetadata(typeof(ConsoleTextBox)) as FrameworkPropertyMetadata;
            var newTextMetadata = new FrameworkPropertyMetadata(string.Empty,
                                                                FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
                                                                oldTextMetadata.PropertyChangedCallback, CoerceConsoleText, isAnimationProhibited: true, System.Windows.Data.UpdateSourceTrigger.LostFocus);

            TextProperty.OverrideMetadata(typeof(ConsoleTextBox), newTextMetadata);
        }
Exemplo n.º 12
0
 static ComboBoxEx()
 {
     //预防下面写法的内存泄漏
     TextProperty.OverrideMetadata(typeof(ComboBoxEx),
                                   new FrameworkPropertyMetadata(
                                       String.Empty,
                                       FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
                                       new PropertyChangedCallback(OnTextChanged)));
 }
Exemplo n.º 13
0
 static MaskedTextBox()
 {
     TextProperty.OverrideMetadata(typeof(MaskedTextBox),
                                   new FrameworkPropertyMetadata(null, new CoerceValueCallback(Text_CoerceValue)));
     InputMaskProperty = DependencyProperty.Register("InputMask", typeof(string), typeof(MaskedTextBox),
                                                     new PropertyMetadata(string.Empty, new PropertyChangedCallback(InputMask_Changed)));
     InputMaskType = DependencyProperty.Register("InputMaskType", typeof(string), typeof(MaskedTextBox),
                                                 new PropertyMetadata(string.Empty, new PropertyChangedCallback(MaskType_Changed)));
 }
Exemplo n.º 14
0
 static HotKeyBox()
 {
     TextProperty.OverrideMetadata(typeof(HotKeyBox),
                                   new FrameworkPropertyMetadata()
     {
         BindsTwoWayByDefault = false,
         Journal = true,
         DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
     });
 }
Exemplo n.º 15
0
        static AutoCompleteTextBox()
        {
            // change default UpdateSourceTrigger to PropertyChanged so we get as-you-type suggestions
            var defaultMetadata = TextProperty.GetMetadata(typeof(TextBox));

            TextProperty.OverrideMetadata(typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(
                                              string.Empty, FrameworkPropertyMetadataOptions.Journal | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                              defaultMetadata.PropertyChangedCallback, defaultMetadata.CoerceValueCallback, true,
                                              System.Windows.Data.UpdateSourceTrigger.PropertyChanged));
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Initializes the <see cref="LabeledTextBox" /> class.
        /// </summary>
        static LabeledTextBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(LabeledTextBox),
                                                     new FrameworkPropertyMetadata(typeof(LabeledTextBox)));

            //hook up the Text Changed event
            TextProperty.OverrideMetadata(
                typeof(LabeledTextBox),
                new FrameworkPropertyMetadata(TextPropertyChanged));
        }
Exemplo n.º 17
0
        static TextBlock()
        {
            TextProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                              "",
                                              (o, e) => (o as TextBlock).TextChangedCallback(e.NewValue as string),
                                              (o, v) => (o as TextBlock).CoerceTextCallback(v as string)));

            ForegroundProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                    Brushes.Black,
                                                    (o, e) => (o as TextBlock).ForegroundChangedCallback(e.NewValue as Brush)));
        }
Exemplo n.º 18
0
        static MaskedTextBox()
        {
            MaskProperty = DependencyProperty.Register("Mask", typeof(string), typeof(MaskedTextBox));

            FrameworkPropertyMetadata metadata = new FrameworkPropertyMetadata();

            metadata.CoerceValueCallback = CoerceText;
            TextProperty.OverrideMetadata(typeof(MaskedTextBox), metadata);

            CommandManager.RegisterClassCommandBinding(typeof(MaskedTextBox), new CommandBinding(ApplicationCommands.Paste, null));
        }
Exemplo n.º 19
0
        static LinkableTextBlock()
        {
            var defaultMetadata = TextBox.TextProperty.GetMetadata(typeof(TextBlock));

            TextProperty.OverrideMetadata(typeof(LinkableTextBlock), new FrameworkPropertyMetadata(
                                              string.Empty,
                                              FrameworkPropertyMetadataOptions.Journal | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                              TextPropertyChanged,
                                              defaultMetadata.CoerceValueCallback,
                                              true,
                                              UpdateSourceTrigger.PropertyChanged));
        }
 static TextBoxExt()
 {
     TextProperty.OverrideMetadata(
         typeof(TextBoxExt),
         // found this metadata with reflector:
         new FrameworkPropertyMetadata(string.Empty,
                                       FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
                                       new PropertyChangedCallback(MyOnTextPropertyChanged), callback
                                       new CoerceValueCallback(MyCoerceText),
                                       true, // IsAnimationProhibited
                                       UpdateSourceTrigger.PropertyChanged)
         );
 }
Exemplo n.º 21
0
        static TextBlock()
        {
            TextProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                              (string)Controls.TextBlock.TextProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                              (o, e) => (o as TextBlock).OnTextChanged(e.NewValue as string)));

            ForegroundProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                    (Brush)ForegroundProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                                    (o, e) => (o as TextBlock).OnForegroundChanged(e.NewValue as Brush)));

            FontSizeProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                  (double)FontSizeProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                                  (o, e) => (o as TextBlock).OnFontSizeChanged((double)e.NewValue)));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Static Constructor for WPF to intialize this control.
        /// </summary>
        static MaskTextBox()
        {
            MaskProperty = DependencyProperty.Register(
                "Mask",
                typeof(string),
                typeof(MaskTextBox),
                new FrameworkPropertyMetadata(null, OnPropertyChanged));

            //Override the meta data for the Text Proeprty of the textbox.
            FrameworkPropertyMetadata metaData = new FrameworkPropertyMetadata();

            metaData.CoerceValueCallback = ForceText;
            TextProperty.OverrideMetadata(typeof(MaskTextBox), metaData);
        }
Exemplo n.º 23
0
        static FormPathTextBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(FormPathTextBox), new FrameworkPropertyMetadata(typeof(FormPathTextBox)));

            var originalMetadata = TextProperty.GetMetadata(typeof(TextBox));

            TextProperty.OverrideMetadata(typeof(FormPathTextBox),
                                          new FrameworkPropertyMetadata(
                                              originalMetadata.DefaultValue,
                                              FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
                                              originalMetadata.PropertyChangedCallback,
                                              originalMetadata.CoerceValueCallback,
                                              true,
                                              UpdateSourceTrigger.PropertyChanged));
        }
Exemplo n.º 24
0
        static ValueRangeTextBox()
        {
            TextProperty.OverrideMetadata(typeof(ValueRangeTextBox),
                                          new FrameworkPropertyMetadata(
                                              null,
                                              TextCoerceValueCallback));

            AcceptsReturnProperty.OverrideMetadata(typeof(ValueRangeTextBox),
                                                   new FrameworkPropertyMetadata(
                                                       false, null, AcceptsReturnCoerceValueCallback));

            AcceptsTabProperty.OverrideMetadata(typeof(ValueRangeTextBox),
                                                new FrameworkPropertyMetadata(
                                                    false, null, AcceptsTabCoerceValueCallback));

            AutomationProperties.AutomationIdProperty.OverrideMetadata(typeof(ValueRangeTextBox),
                                                                       new UIPropertyMetadata("ValueRangeTextBox"));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Static Constructor
        /// </summary>
        static DateTimeEditor()
        {
            //override the meta data for the Text Proeprty of the textbox
            FrameworkPropertyMetadata metaData = new FrameworkPropertyMetadata();

            metaData.CoerceValueCallback = ForceText;
            TextProperty.OverrideMetadata(typeof(DateTimeEditor), metaData);

            formatProvider.Add("en-GB", new DateTimeFormatProvider()
            {
                regex      = new Regex(@"^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$"),
                DateFormat = @"dd/MM/yyyy",
                TimeFormat = "HH:mm:ss"
            });
            formatProvider.Add("en-UK", new DateTimeFormatProvider()
            {
                regex      = new Regex(@"(?n:^(?=\d)((?<month>(0?[13578])|1[02]|(0?[469]|11)(?!.31)|0?2(?(.29)(?=.29.((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|(?!.3[01])))(?<sep>[-./])(?<day>0?[1-9]|[12]\d|3[01])\k<sep>(?<year>(1[6-9]|[2-9]\d)\d{2})(?(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$) "),
                DateFormat = @"MM/dd/yyyy",
                TimeFormat = "HH:mm:ss"
            });
        }
Exemplo n.º 26
0
        static SelectableTextBlock()
        {
            var defaultMetadata = (FrameworkPropertyMetadata)TextProperty.GetMetadata(typeof(TextBox));
            var newMetadata     = new FrameworkPropertyMetadata(
                defaultMetadata.DefaultValue,
                FrameworkPropertyMetadataOptions.None,
                defaultMetadata.PropertyChangedCallback,
                defaultMetadata.CoerceValueCallback,
                defaultMetadata.IsAnimationProhibited,
                defaultMetadata.DefaultUpdateSourceTrigger);

            TextProperty.OverrideMetadata(typeof(SelectableTextBlock), newMetadata);
            var sealedProperty = typeof(PropertyMetadata).GetProperty("Sealed", BindingFlags.Instance | BindingFlags.NonPublic);

            if (sealedProperty != null)
            {
                sealedProperty.SetValue(newMetadata, false);
                newMetadata.BindsTwoWayByDefault = false;
                newMetadata.Journal = false;
                sealedProperty.SetValue(newMetadata, true);
            }
        }
 static AutoCompleteTextBox()
 {
     TextProperty.OverrideMetadata(typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
 }
Exemplo n.º 28
0
 /// <summary>
 ///   Initializes static members of the <see cref = "FormattingTextBox" /> class.
 /// </summary>
 static FormattingTextBox()
 {
     // DefaultStyleKeyProperty.OverrideMetadata(typeof(FormattingTextBox), new FrameworkPropertyMetadata(typeof(FormattingTextBox)));
     TextProperty.OverrideMetadata(typeof(FormattingTextBox), new FrameworkPropertyMetadata(TextChangedCallback));
 }
Exemplo n.º 29
0
 static ComboBox2()
 {
     TextProperty.OverrideMetadata(typeof(ComboBox2), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTextChanged)));
 }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes static members of the <see cref="EditableTextBlock" /> class.
 /// </summary>
 static EditableTextBlock()
 {
     TextProperty.OverrideMetadata(
         typeof(EditableTextBlock),
         new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
 }