This is a migrated thread and some comments may be shown as answers.

RadWrapPanel does not wrap inside a ScrollViewer

1 Answer 148 Views
VirtualizingWrapPanel
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cameron Molyneux
Top achievements
Rank 1
Cameron Molyneux asked on 18 Sep 2012, 01:39 PM
Hi,

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>
      </ScrollViewer>


Cheers.

1 Answer, 1 is accepted

Sort by
0
Graeme
Top achievements
Rank 2
answered on 19 Sep 2012, 04:27 AM
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">
        <Setter.Value>
            <ControlTemplate TargetType="ListBoxItem">
                <Grid Background="{TemplateBinding Background}">
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal"/>
                            <VisualState x:Name="MouseOver"/>
                            <VisualState x:Name="Disabled"/>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="SelectionStates">
                            <VisualState x:Name="Unselected"/>
                            <VisualState x:Name="Selected"/>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="FocusStates">
                            <VisualState x:Name="Focused"/>
                            <VisualState x:Name="Unfocused"/>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ContentPresenter x:Name="contentPresenter"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      Content="{TemplateBinding Content}"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      Margin="{TemplateBinding Padding}"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>



Tags
VirtualizingWrapPanel
Asked by
Cameron Molyneux
Top achievements
Rank 1
Answers by
Graeme
Top achievements
Rank 2
Share this question
or