Why does my binding break down on SilverLight ProgressBars?
Posted
by Bill Jeeves
on Stack Overflow
See other posts from Stack Overflow
or by Bill Jeeves
Published on 2010-06-18T09:17:09Z
Indexed on
2010/06/18
9:23 UTC
Read the original article
Hit count: 185
Silverlight
|silverlight-4.0
I asked a similar question about charts but I have given up on that and I am using progress bars instead.
Essentially, I have ten progress bars in a Silverlight control. Each is showing a different value and updating every couple of seconds (it's a process monitor). Each progress bar has the same minimum value and maximum value so the bars can be compared.
Trying to follow the M-V-VM model, I have bound the value of each bar to a property in my ViewModel. All of the maximum values for the bar are bound to a single property. When the model updates, the values and the maximum can all update. This allows the bars to re-scale as the sizes grow.
I'm finding that the binding will stop working sometimes on one or more bars. I suspect it is because a bar's value becomes higher than the maximum occasionally. This is because if I update the maximums first and they are going down, the values will be to high. If I update the values first when the maximum needs increasing, the values are too high again.
Is there a way to stop this behaviour? Some way, perhaps, to tell the progress bars that it's OK to temporarily go too high? Or some way to tell the bindings that they shouldn't be disabled when this happens? Or maybe I've got this completely wrong and there's some other issue with ProgressBar binding I don't know about?
© Stack Overflow or respective owner