views:

349

answers:

2

Hi,

Does anybody know how I can add a scroll bar to a wrappanel contained within an itemscontrol?

+2  A: 

Wrap a ScrollViewer tag around it

<ScrollViewer>
   <WrapPanel>
      <!-- your other controls here -->
   </WrapPanel>
</ScrollViewer>
Carlo
A: 

That won't work here,

    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <ScrollViewer>
                <WrapPanel Orientation="Horizontal"  />
            </ScrollViewer>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

You get a nasty exception, VisualTree of ItemsPanelTemplate must contain a Panel. 'System.Windows.Controls.ScrollViewer' is not a Panel.

James