(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Tip: How to add scrollbars to ItemsControl?

(2 votes)
Ivan Dragoev
>
Ivan Dragoev
Joined Oct 25, 2007
Articles:   7
Comments:   9
More Articles
10 comments   /   posted on Sep 03, 2008
Categories:   Controls

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>

 


Subscribe

Comments

  • -_-

    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>

  • iiordanov

    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!
  • -_-

    RE: Tip: How to add scrollbars to ItemsControl?


    posted by StarterKit on Jun 28, 2010 23:48
    Works Great To me
  • -_-

    RE: Tip: How to add scrollbars to ItemsControl?


    posted by JerseyNo10 on Sep 09, 2010 15:02
    Great stuff, just what I needed...
  • -_-

    RE: Tip: How to add scrollbars to ItemsControl?


    posted by jose on Oct 07, 2010 21:31
    cool

Add Comment

Login to comment:
  *      *       
Login with Facebook