title: Why is ProgressBar.SetValue throwing ArgumentException with valid values?
body: <p>I am using WPF's ProgressBar object, which has a Value property, and I can pass it a constant int or decimal value and it doesn't complain, but if I pass it a float (or int or string) variable value, it barfs an ArgumentException (e.g. <code>"Message='0.02380952' is not a valid value for property 'Value'."</code>) at me, which just seems preposterous to me, and has me stumped. The <a href="http://windowsclient.net/learn/video.aspx?v=57027" rel="nofollow">MS example</a> I am following uses constant float values. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.value.aspx" rel="nofollow">MS doc reference to the Value property</a> however says it is an int, which seems just wrong since I can pass it constant .1 or .5 and get the right behavior, and my MS example uses 0 and 1 and the min and max values. So, what do I need to do here?</p>
  
  <p>My code:</p>
  
  <p>xaml: </p>
  
  <pre><code>&lt;ProgressBar x:Name="prgProgress" Width="200" Height="20" Minimum="0" Maximum="100" /&gt;
  </code></pre>
  
  <p>c#:</p>
  
  <pre><code>float numMems = ListToShow.Count; 
  float numDone = 0.0f;
  int fracDone = 0;
  string sProgress = "0%";
  foreach (RAM_Member mem in ListToShow)
  {
      if (isCanceled == true) break;
      mem.CalculateValues();
      numDone++;
      fracDone = (int)(100.0 * numDone / numMems);
      sProgress = (100 * numDone / numMems).ToString("0.") + "%";
      Dispatcher.BeginInvoke(DispatcherPriority.Background, (SendOrPostCallback)delegate { prgProgress.SetValue(ProgressBar.ValueProperty, fracDone); }, null);
      Dispatcher.BeginInvoke(DispatcherPriority.Background, (SendOrPostCallback)delegate { txtProgress.SetValue(TextBlock.TextProperty, sProgress); }, null);
  }
  </code></pre>