Recommended

More from Ivan Dragoev

Skip Navigation LinksHome / Tips / View Tip

Tip: How to add scrollbars to ItemsControl?

+ Add to SilverlightShow Favorites
7 comments   /   posted by Ivan Dragoev on Sep 03, 2008
(0 votes)
Tags: Silverlight , ScrollViewer , ItemsControl
Categories: Controls and UI

To add scrollbars to ItemsControl you have to modify the control template and to add ScrollViewer for the ItemsPresenter.

Xaml

<ItemsControl >
<
ItemsControl.Template>
<
ControlTemplate>
<
ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}">
<
ItemsPresenter />
</
ScrollViewer>
</
ControlTemplate>
</
ItemsControl.Template>
</
ItemsControl>

 

Share


Comments

Comments RSS RSS
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by CrazyTmack on Jul 05, 2009 21:47
    Thanks, this was a ridiculously simple and to the point answer.
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by Al on Aug 14, 2009 17:37
    Thanks for the tip.  It was just what I needed.
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by drjohnson on Aug 17, 2009 18:41
    Thanks, saved me a lot of searching.
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by AJ on Feb 19, 2010 15:10
    thanks, i was looking for jst the same thing :)
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by Tom on Mar 18, 2010 13:20

    Didn't work for me but it pointed me in the right direction so it might be outdated. This worked for me with Silverlight 4:

    <ScrollViewer x:Name="ScrollViewer" Width="190" Height="75" >
                                    <ItemsControl
                                    ItemsSource="{Binding Blaats}" Padding="0" 
                                    >
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected,  Mode=TwoWay}" />
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                </ScrollViewer>

  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by iiordanov on Mar 18, 2010 13:53
    @Tom - thanks for your remark, we will update the tip :)
  • RE: Tip: How to add scrollbars to ItemsControl?  

    posted by Mad on Mar 29, 2010 17:00
    Works for me, great! Thanks!

Add Comment

 
 

   
  
  
   
Please add 2 and 5 and type the answer here:

Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)