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

New Post: IntegerUpDown UpdateSourceTrigger

$
0
0
Hi,

You could create your own IntegerUpDown, use a UpdateSourceTrigger of LostFocus and override the OnSpin method to update the binding when user uses the up/down arrows :
<xctk:IntegerUpDown x:Name="_first" />
 <local:MyIntegerUpDown x:Name="_second"
                                        Value="{Binding Value, ElementName=_first, UpdateSourceTrigger=LostFocus}" />

 public class MyIntegerUpDown : IntegerUpDown
  {
    protected override void OnSpin( SpinEventArgs e )
    {
      base.OnSpin( e );

      BindingExpression binding = BindingOperations.GetBindingExpression( this, MyIntegerUpDown.ValueProperty );
      binding.UpdateSource();
    }
  }

Viewing all articles
Browse latest Browse all 4964

Trending Articles



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