title: Bound property not called for textbox value > int.MaxValue
body: <p>Bound property not called for textbox value > int.MaxValue</p>
  
  <p>I need to revert to last value in a textbox, if entered value is greater than int.MaxValue.
  Please refer below code for this.</p>
  
  <p>MainWindow.xaml</p>
  
  <pre><code>&lt;Window x:Class="SampleWPFApplication.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;StackPanel&gt;
          &lt;TextBox Text="{Binding Count, UpdateSourceTrigger=LostFocus}" /&gt;
          &lt;Button Content="Click!" Width="100" Height="50"/&gt;
      &lt;/StackPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>MainWindow.xaml.cs</p>
  
  <pre><code>using System.Windows;
  namespace SampleWPFApplication
  {
       /// &lt;summary&gt;
       /// Interaction logic for MainWindow.xaml
       /// &lt;/summary&gt;
       public partial class MainWindow : Window
       {
           public MainWindow()
           {
               InitializeComponent();
               this.DataContext = this;
           }
  
           private int _count = 32;
       public int Count
           {
              get { return _count;}
              set 
              {
                  if(value &lt;= int.MaxValue)
                      _count = value;
              }
           }
       }
  }
  </code></pre>
  
  <p>Set a breakpoint at the setter of the Count property. This breakpoint is hit for values less than int.MaxValue. 
  int.Maxvalue has a value 2147483647 on my system. if you give a value greater than this, breakpoint won't hit and textbox is encircled with red rectangle. 
  I would like to revert to previous value in the textbox for out of range values.</p>
  
  <p>If I replace int.MaxValue in the above property setter with a value not equal to int.MaxValue(For e.g 999), it works fine.
  I believe textbox internally has a Max value as int.MaxValue and on giving a value greater than this it does its own validation, which fails and binding is not updated.</p>
  
  <p>I have set the PresentationTraceSources.TraceLevel=High in the xaml as explained in link <a href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx</a>
  and got the StackOverFlowException.</p>
  
  <blockquote>
    <p>System.Windows.Data Warning: 95 : BindingExpression (hash=52085517):
    Got LostFocus event from TextBox (hash=10223660) System.Windows.Data
    Warning: 90 : BindingExpression (hash=52085517): Update - got raw
    value '2147483649' 'SampleWPFApplication.vshost.exe' (Managed
    (v4.0.30319)): Loaded
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll',
    Skipped loading symbols. Module is optimized and the debugger option
    'Just My Code' is enabled. System.Windows.Data Error: 7 : ConvertBack
    cannot convert value '2147483649' (type 'String').
    BindingExpression:Path=Count; DataItem='MainWindow' (Name=''); target
    element is 'TextBox' (Name=''); target property is 'Text' (type
    'String') OverflowException:'System.OverflowException: Value was
    either too large or too small for an Int32.    at
    System.Number.ParseInt32(String s, NumberStyles style,
    NumberFormatInfo info)    at
    System.String.System.IConvertible.ToInt32(IFormatProvider provider)<br>
    at System.Convert.ChangeType(Object value, Type conversionType,
    IFormatProvider provider)    at
    MS.Internal.Data.SystemConvertConverter.ConvertBack(Object o, Type
    type, Object parameter, CultureInfo culture)    at
    System.Windows.Data.BindingExpression.ConvertBackHelper(IValueConverter
    converter, Object value, Type sourceType, Object parameter,
    CultureInfo culture)' System.Windows.Data Warning: 93 :
    BindingExpression (hash=52085517): Update - implicit converter
    produced {DependencyProperty.UnsetValue} System.Windows.Data Warning:
    94 : BindingExpression (hash=52085517): Update - using final value
    {DependencyProperty.UnsetValue}</p>
  </blockquote>
  
  <p>Can someone explain this behavior and way yto overcome this.?
  Also, is there a way to override the RED rectangle behavior?</p>
  
  <p>Similar question (<a href="https://stackoverflow.com/questions/8252828/textbox-issue-with-validation-using-idataerrorinfo-with-integer-value-more-tha">TextBox - Issue with validation using IDataErrorInfo with integer Value more than int.MaxValue (2147483647)</a>) with no solution </p>
  
  <p>Workaround: One workaround is to change the datatype of property from int to long.</p>