Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 215901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:30:51+00:00 2026-05-11T18:30:51+00:00

I’m making a simple LOB app which loads data from an XML file and

  • 0

I’m making a simple LOB app which loads data from an XML file and displays it in a list with a few buttons for editing.

In my first attempt, everything was ok except that the list scrolled downwards in one long column. I would prefer the data to wrap so that at the bottom of the Window it starts a second column, and so on – if you resize the Window the data should resize accordingly.

First, I just put the ListBox inside a ScrollViewer. This made no difference whatsoever.

Then, I added a WrapPanel within the ItemTemplate. At this point I got a long row horizontally but it never wrapped to a second row, despite my setting the ScrollViewer.HorizontalScrollbar=disabled.

I’ve searched around the web on various blogs and forums, but can’t see the difference between the suggestions and my code (included below). Any tips would be much appreciated.

<Window x:Class="MyApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="My App" Height="300" Width="400"
        FocusManager.FocusedElement="{Binding ElementName=eventsList}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
                <ScrollViewer Grid.Row="0" Grid.Column="0"     HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
            <ListBox Name="eventsList">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </ScrollViewer>

        <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal"     HorizontalAlignment="Center" Visibility="Collapsed">
            <Button Name="action1Button" />
            <Button Name="action2Button" />
            <Button Name="action3Button" />
        </StackPanel>
    </Grid>
</Window>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:30:51+00:00Added an answer on May 11, 2026 at 6:30 pm

    It seems like you were on the right track: replacing the ItemsPanelTemplate in the ListBox with a WrapPanel, setting WrapPanel’s Orientation to Vertical, and setting ScrollViewer.VerticalScrollBar to Disabled should be all you need to do.

    This works for me:

    <Window x:Class="ScrollingWrapPanel.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
        <Grid>
            <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel IsItemsHost="True" Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Red"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Orange"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Yellow"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Green"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Blue"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Indigo"/>
                </ListBoxItem>
                <ListBoxItem>
                    <Rectangle Width="80" Height="80" Margin="10" Fill="Violet"/>
                </ListBoxItem>
            </ListBox>
        </Grid>
    </Window>
    

    That should cause it to render out a full column vertically, wrap, and then continue on the next column, scrolling as necessary horizontally (but not vertically), as in the picture:

    ListBox with WrapPanel wrapping vertically

    The key things in this implementation are

    1. Setting Orientation=”Vertical” on the WrapPanel so that things wrap vertically and not horizontally, and
    2. Setting ScrollViewer.VerticalScrollBarVisibility=”Disabled” on the ListBox so that the ScrollViewer knows to restrict its height to the available space.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 161k
  • Answers 161k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $('link').observe('click', function(e) { Event.stop(e); }); or $('link').observe('click', function(e) { e.stop();… May 12, 2026 at 11:44 am
  • Editorial Team
    Editorial Team added an answer Instead of myDataStream.get(myData), what you do is overload operator>> for… May 12, 2026 at 11:44 am
  • Editorial Team
    Editorial Team added an answer Log4Net works well on compact framework (for general logging), I… May 12, 2026 at 11:44 am

Related Questions

Lately I have been playing a game on my iPhone called Scramble. Some of
I'm making a simple 2 player game in XNA and started looking into saving
I'm making a simple scheduler with C# in .Net. All it does is execute
I'm making a simple 2D game for the iPhone. It's based on CrashLanding. so

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.