Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: IntegerUpDown is setting the value to defaultvalue specified only when I click on some other control

$
0
0
Hi,

The event that triggers a set to defaultValue of an integerUpDown when "Empty" is the "Text" value is :
TextBox.LostFocus
where "TextBox" is the WatermarkTextBox included in the template of a NumericUpDown control.

In other word, when the focus shift away from the IntegerUpDown, it will sync the "Text" and "Value" property : in this case to the "Default" Value, via the "ComitInput()" method.

What you could do is define your own IntegerUpDown and call "ComitInput()" when mouse leaves the control :
 public class MyIntegerUpDown : IntegerUpDown
  {
    public MyIntegerUpDown()
    {
      Mouse.AddMouseLeaveHandler( this, OnMouseLeave );
    }

    private void OnMouseLeave( object sender, MouseEventArgs e )
    {
      this.CommitInput();
    }
  }

Viewing all articles
Browse latest Browse all 4964


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>