コード例 #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: new DoubleToStringConverter());

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

            if (!this.IsStable)
            {
                valueBox.Text = "";
            }
        }
コード例 #2
0
        protected override void OnDispose()
        {
            if (valueBox == null)
            {
                return;
            }

            BindingOperations.ClearAllBindings(valueBox);

            valueBox = null;
        }