Subscribe to the RSS feed then follow me on twitter at @mrlacey

Thursday, July 07, 2011

Creating a horizontally scrolling list #wp7dev

I recently needed to show someone how to make a ListBox scroll horizontally rather than vertically. Here's what I did:

  
      
          
              
              
          
      
      
          
              
              
          
      
  

The key part is: '<StackPanel Orientation="Horizontal" />'
It's this that controls the direction. of item display.

The next two parts give us the correct scrolling behaviour that we want.
Setting 'ScrollViewer.HorizontalScrollBarVisibility="Auto"' enables horizontal scrolling.
Setting 'ScrollViewer.VerticalScrollBarVisibility="Disabled"' prevents vertical scrolling.

The thing to note is that setting XxxxScrollBarVisibility doesn't just control the visibility if the scrollbar it also controls whether scrolling in that direction is possible.

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

No comments:

Post a Comment