Derik Whittaker



Help my Slider control does not work inside a Grid in WP7

Ok, so I am trying to build out an UI where I use the <Slider> UX control to indicate passing time (this is for the WP7 application).  But the oddest thing happened, when I put the slider control onto my page it did not show up.  I thought maybe I was doing something wrong so I dropped the control onto a sample application and everything worked just fine... Odd

Here is the Xaml that I tried the first time around.


If you look towards the bottom of the Xaml you will see the Slider control.  This should work but it does not..odd.  Now when I put this into my sample application it worked just fine.  After looking at the code for a minute it dawned on me in my sample app I did not have the Slider in a grid.  So I put it into a grid and sure enough it stopped being visible again.  I did a bit of searching on bing and google but i could not find an answer.  So I turned to Twitter and sure enough I got a suggestion from @sirleamont (see below)



After the suggestion from @sirleamont I created the Xaml as below and surprise it worked :)



The only change I made is to wrap the Slider control inside a StackPanel.  Something still seems odd here, but hey it works.  If anyone knows exactly why this is the case please let me know.

Till next time,

Posted 12-27-2010 12:34 PM by Derik Whittaker


About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)