Esempio n. 1
0
 protected override void OnDetaching()
 {
     base.OnDetaching();
     this.AssociatedObject.Loaded   -= this.AssociatedObjectLoaded;
     this.AssociatedObject.GotFocus -= this.AssociatedObjectTextChanged;
     this.notifier = null;
 }
Esempio n. 2
0
        protected override void OnDetaching()
        {
            base.OnDetaching();
            this.AssociatedObject.Loaded            -= this.AssociatedObjectLoaded;
            this.AssociatedObject.PasswordChanged   -= this.AssociatedObjectPasswordChanged;

            this.notifier = null;
        }
        protected override void OnDetaching()
        {
            base.OnDetaching();
            AssociatedObject.Loaded           -= AssociatedObjectLoaded;
            AssociatedObject.TextChanged      -= AssociatedObjectTextChanged;
            AssociatedObject.IsVisibleChanged -= AssociatedObjectIsVisibleChanged;

            notifier = null;
        }
Esempio n. 4
0
        private void AssociatedObjectLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            this.adorner = new TextBlockAdorner(this.AssociatedObject, this.Label, this.LabelStyle);

            this.UpdateAdorner();

            //AddValueChanged for IsFocused in a weak manner
            this.notifier               = new WeakPropertyChangeNotifier(this.AssociatedObject, UIElement.IsFocusedProperty);
            this.notifier.ValueChanged  += new EventHandler(this.UpdateAdorner);
        }
 /*
  * Mask Character  Accepts  Required?
  * 0  Digit (0-9)  Required
  * 9  Digit (0-9) or space  Optional
  #  Digit (0-9) or space  Required
  # L  Letter (a-z, A-Z)  Required
  # ?  Letter (a-z, A-Z)  Optional
  # &  Any character  Required
  # C  Any character  Optional
  # A  Alphanumeric (0-9, a-z, A-Z)  Required
  # a  Alphanumeric (0-9, a-z, A-Z)  Optional
  # Space separator  Required
  # .  Decimal separator  Required
  # ,  Group (thousands) separator  Required
  # :  Time separator  Required
  # /  Date separator  Required
  # $  Currency symbol  Required
  # In addition, the following characters have special meaning:
  # Mask Character  Meaning
  # <  All subsequent characters are converted to lower case
  # >  All subsequent characters are converted to upper case
  |  Terminates a previous < or >
  \  Escape: treat the next character in the mask as literal text rather than a mask symbol
  */
 void AssociatedObjectLoaded(object sender, System.Windows.RoutedEventArgs e)
 {
     this.Provider              = new MaskedTextProvider(InputMask, CultureInfo.CurrentCulture);
     this.Provider.PromptChar   = this.PromptChar;
     this.Provider.SkipLiterals = true;
     this.Provider.ResetOnSpace = this.ResetOnSpace;
     this.Provider.Set(AssociatedObject.Text);
     AssociatedObject.Text = GetProviderText();
     //seems the only way that the text is formatted correct, when source is updated
     //AddValueChanged for TextProperty in a weak manner
     this._notifier = new WeakPropertyChangeNotifier(this.AssociatedObject, TextBox.TextProperty);
     this._notifier.ValueChanged += new EventHandler(this.UpdateText);
 }
Esempio n. 6
0
        private void AssociatedObjectLoaded(object sender, RoutedEventArgs e)
        {
            this.adorner = new TextBlockAdorner(this.AssociatedObject, this.LabelStyle);

            // Set binding in code so that it updates everytime
            Binding binding = new Binding();

            binding.Source = this;
            binding.Path   = new PropertyPath("Label");
            adorner.adornerTextBlock.SetBinding(TextBlock.TextProperty, binding);

            this.UpdateAdorner();

            //AddValueChanged for IsFocused in a weak manner
            this.notifier = new WeakPropertyChangeNotifier(this.AssociatedObject, UIElement.IsFocusedProperty);
            this.notifier.ValueChanged += this.UpdateAdorner;
        }