Esempio n. 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            valueBox = GetTemplateChild <SubmitTextBox>("PART_valueBox");

            if (this.Value is double)
            {
                Binding b = BindingHelper.SetBinding(
                    this, ValueProperty,
                    valueBox, TextBox.TextProperty,
                    converter: ResourceManager.GetConverter("DoubleToString"));

                b.ValidationRules.Add(new DoubleRule());
            }
            else
            {
                BindingHelper.SetBinding(
                    this, ValueProperty,
                    valueBox, TextBox.TextProperty);
            }

            if (!this.IsStable)
            {
                valueBox.Text = "";
            }
        }
Esempio n. 2
0
        protected override void OnDispose()
        {
            if (valueBox == null)
            {
                return;
            }

            BindingOperations.ClearAllBindings(valueBox);

            valueBox = null;
        }
Esempio n. 3
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            sourceBox    = GetTemplateChild <SubmitTextBox>("PART_sourceBox");
            sourceButton = GetTemplateChild <Button>("PART_sourceButton");

            BindingHelper.SetBinding(
                this, ValueProperty,
                sourceBox, SubmitTextBox.TextProperty);

            sourceButton.Click += SourceButton_Click;
        }