cschleiden
Published on

Windows Phone 7 and Silverlight Slider Binding Bug

Authors

It took me about 4-5 hours today to finally recognize why one my custom controls behaved in a strange way. It is a control derived from the Silverlight slider control and I encountered strange behavior when binding the Maximum and Minimum properties. After countless checks to make sure, that my ViewModel logic was flawless I finally discovered that … the order of attributes in the xaml code *does* matter when binding these exact properties.

It turns out, instead of this

<Slider Name="slider" Grid.Column="1" Minimum="{Binding MinValue}" Maximum="{Binding MaxValue}" />

it should be this:

<Slider Name="slider" Grid.Column="1" Maximum="{Binding MaxValue}" Minimum="{Binding MinValue}" />

(Source: http://social.msdn.microsoft.com/Forums/en-US/silverlightgeneral/thread/5a08a3c7-66d3-4ee0-aa29-43bb8d186ab7)

Other people have noticed the same: http://dotnetbyexample.blogspot.com/2009/08/bind-silverlight-3-slider-value-minimum.html