RadWrapPanel does not wrap inside a ScrollViewer

2 posts, 0 answers
  1. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 18 Sep 2012 Link to this post


    I would've added this issue to PITS however there was no option for WrapPanel in the drop down.

    If I place a RadWrapPanel inside a ScrollViewer, and style the ScrollViewer the WrapPanel no longer wraps. All the items go from left to right and you have to scroll horizonally.

    However, if I do not style the ScrollViewer, the WrapPanel works as expected.

    This issue arose after we updated to the latest version of Telerik controls.

    For your reference here's the XAML:

          <ScrollViewer telerik:StyleManager.Theme="Metro">
              <telerik:RadWrapPanel Grid.Column="1" Grid.Row="3" x:Name="barcodeContainer" ItemWidth="280" ItemHeight="115" Margin="5,10,5,10"></telerik:RadWrapPanel>


  2. Graeme
    Graeme avatar
    21 posts
    Member since:
    May 2012

    Posted 18 Sep 2012 Link to this post

    I found the same thing but there are many ways to look at problem. I got around it by modifying a Listbox to act like a ScrollViewer. Here's a Xaml snippet that I've used:

    <Style x:Key="ListBoxItemNoSelectStyle" TargetType="ListBoxItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="4" />
        <Setter Property="TabNavigation" Value="Local" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Disabled"/>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected"/>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused"/>
                        <ContentPresenter x:Name="contentPresenter"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"/>

Back to Top