Bug binding to Slider.Maximum
-
Friday, August 05, 2011 11:38 AM
If you look at this: http://mister-j.dyndns.org/peterj/pete/SilverlightApplication1TestPage.html
It binds the values 3 and 5 to the Minimum and Maximum values of the slider. However, the Maximum binding isn't picked up.
The source is this:
XAML:
<Grid x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TextBlock Grid.Column="0" Text="{Binding MinValue}" VerticalAlignment="Center"/> <Slider Name="slider" Grid.Column="1" Minimum="{Binding MinValue}" Maximum="{Binding MaxValue}" /> <TextBlock Grid.Column="2" Text="{Binding MaxValue}" VerticalAlignment="Center"/> <TextBlock Grid.Row="1" Grid.ColumnSpan="3" Text="{Binding Info}" /> </Grid>
and the code is this:public partial class MainPage: UserControl { public double MinValue { get; set; } public double MaxValue { get; set; } public string Info { get { return "Slider Minimum = " + slider.Minimum + ", Maximum = " + slider.Maximum; } } public MainPage() { MinValue = 3.0; MaxValue = 5.0; DataContext = this; InitializeComponent(); } }
All Replies
-
Friday, August 05, 2011 11:40 AMBTW I am using the Silverlight 5 beta runtime
-
Monday, August 08, 2011 11:03 PM
Hi, this is a known (annoying) problem.
Read this blog post: http://dotnetbyexample.blogspot.com/2009/08/bind-silverlight-3-slider-value-minimum.html
Also Silverligth 4 is affected by this problem, while WPF4 isn't.
In a nutshell, try change
<Slider Name="slider" Grid.Column="1" Minimum="{Binding MinValue}" Maximum="{Binding MaxValue}" />
into
<Slider Name="slider" Grid.Column="1" Maximum="{Binding MaxValue}" Minimum="{Binding MinValue}" />
- Marked As Answer by Mr J5 Monday, August 15, 2011 2:06 PM
-
Tuesday, January 10, 2012 5:59 PMStill applies to Silverlight 5 as well.
-
Wednesday, May 08, 2013 6:19 PM
Still applies to Silverlight 5 as well.
The bug remains unfixed as of May 2013 and impacts Surface Store apps, in addition see this other bug too.
I'm trying to do pretty basic stuff on a Surface and so far have found two bugs in Slider, this latest one being quite serious with no apparent workaround.
Cap'n

