Sliders not using the values I enter

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I am developing an app for Windows Phone 7, and in the XAML I have a page with the following 3 sliders:

<Slider Name="sldOuter" Maximum="205" Minimum="50" Margin="0,-15,0,-45" Value="150" SmallChange="1" LargeChange="1"/>
<Slider Name="sldInner" Maximum="{Binding ElementName=sldOuter,Path=Value}" Minimum="5" Margin="0,-15,0,-45" LargeChange="1" SmallChange="1" Value="75"/>
<Slider Name="sldFromInner" Maximum="{Binding ElementName=sldInner, Path=Value}" Minimum="0" Margin="0,-15,0,-40" Value="25" SmallChange="1" LargeChange="1"/>

When I do a debug with a breakpoint in the MyBase.Loaded event, I get the following values in the Immediate Window:

?Me.sldOuter.Value
150.0
?Me.sldOuter.Minimum
50.0
?Me.sldOuter.Maximum
205.0
?Me.sldInner.Value
5.0
?Me.sldInner.Minimum
5.0
?Me.sldInner.Maximum
5.0
?Me.sldFromInner.Value
1.0
?Me.sldFromInner.Minimum
0.0
?Me.sldFromInner.Maximum
5.0

Notice that all the values for sldOuter are correct, but the Value property for sldInner and sldFromInner are not the values entered in code. I noticed that in Visual Studio 2010 the values displayed for the Value property in the Properties window do not match the values in code (they are the values I see in the Immediate window). If I attempt to change the value from the Properties window, it will change the value in my code, but then immediately change the value in the Properties window back. It's almost as if Visual Studio 2010 doesn't want me to change these values. Why is this happening, and how can I fix it?
 
I am developing an app for Windows Phone 7, and in the XAML I have a page with the following 3 sliders:

<Slider Name="sldOuter" Maximum="205" Minimum="50" Margin="0,-15,0,-45" Value="150" SmallChange="1" LargeChange="1"/>
<Slider Name="sldInner" Maximum="{Binding ElementName=sldOuter,Path=Value}" Minimum="5" Margin="0,-15,0,-45" LargeChange="1" SmallChange="1" Value="75"/>
<Slider Name="sldFromInner" Maximum="{Binding ElementName=sldInner, Path=Value}" Minimum="0" Margin="0,-15,0,-40" Value="25" SmallChange="1" LargeChange="1"/>

When I do a debug with a breakpoint in the MyBase.Loaded event, I get the following values in the Immediate Window:

?Me.sldOuter.Value
150.0
?Me.sldOuter.Minimum
50.0
?Me.sldOuter.Maximum
205.0
?Me.sldInner.Value
5.0
?Me.sldInner.Minimum
5.0
?Me.sldInner.Maximum
5.0
?Me.sldFromInner.Value
1.0
?Me.sldFromInner.Minimum
0.0
?Me.sldFromInner.Maximum
5.0

Notice that all the values for sldOuter are correct, but the Value property for sldInner and sldFromInner are not the values entered in code. I noticed that in Visual Studio 2010 the values displayed for the Value property in the Properties window do not match the values in code (they are the values I see in the Immediate window). If I attempt to change the value from the Properties window, it will change the value in my code, but then immediately change the value in the Properties window back. It's almost as if Visual Studio 2010 doesn't want me to change these values. Why is this happening, and how can I fix it?
 
Back
Top