Windows Phone 7 and Silverlight Slider Binding Bug

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s