Inside ScrollViewer problem with ListBox ItemsPanel as WrapPanel

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
Vulten
Posts: 1
Joined: Mon Mar 28, 2016 4:02 am

Inside ScrollViewer problem with ListBox ItemsPanel as WrapPanel

Postby Vulten » Sun Apr 03, 2016 4:19 am

If you set the ListBox.ItemsPanel to a WrapPanel nothing is shown if you place the entier ListBox inside a ScrollViewer. Outside the ScrollViewer it works fine.

Code: Select all

       
        <!--<ScrollViewer>-->
            <ListBox BorderThickness="2" BorderBrush="Black" Margin="3">
                <ListBoxItem Content=" Item1 x"/>
                <ListBoxItem Content=" Item2 x"/>
                <ListBoxItem Content=" Item3 x"/>
                <ListBoxItem Content=" Item4 x"/>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        <!--</ScrollViewer>-->
       

JS-Support @Userware
Site Admin
Posts: 1078
Joined: Tue Apr 08, 2014 3:42 pm

Re: Inside ScrollViewer problem with ListBox ItemsPanel as WrapPanel

Postby JS-Support @Userware » Mon Apr 04, 2016 9:13 am

Dear Vulten,

Welcome to the forums and thank you for the bug report.

We have been able to reproduce it when placing the code inside a Grid (please let me know if you encounter the issue also when the code is placed inside something else).

We are going to attempt to fix it.

In the meantime, you may be able to work around it by placing the code in a different control such as a Border. Here is an example where I have created a new "Empty Application" project named "Application1", and placed the following code in MainPage.xaml:

Code: Select all

<Page
    x:Class="Application1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Application1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Border>
        <ScrollViewer>
            <ListBox BorderThickness="2" BorderBrush="Black" Margin="3">
                <ListBoxItem Content=" Item1 x"/>
                <ListBoxItem Content=" Item2 x"/>
                <ListBoxItem Content=" Item3 x"/>
                <ListBoxItem Content=" Item4 x"/>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </ScrollViewer>
    </Border>
</Page>


Thank you again.

Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests

 

 

cron