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 7218275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:27:38+00:00 2026-05-28T21:27:38+00:00

I am trying to do an interface in WPF where a list of item

  • 0

I am trying to do an interface in WPF where a list of item is displayed, taking as little vertical space as possible:

mockup

My instinct was to use an ItemsControl to bind my list, and to put the UI for each item into a WrapPanel. Unfortunately by default, each item starts at a new line regardless of the window’s size. Adding a StackPanel with Orientation="Horizontal" makes all items in a single line, regardless of the size…

    <!--<ScrollViewer Grid.Row="0" Grid.Column="0"
          VerticalScrollBarVisibility="Auto">-->
        <ItemsControl  Margin="0,4" ItemsSource="{Binding Path=Watchers}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal"></StackPanel>
            </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.Resources>
                <DataTemplate DataType="{x:Type Core:Watcher}">
                    <WrapPanel Orientation="Horizontal">
                        <TextBlock Margin="0,2" Text="{Binding Path=Name}"
                        Width="250px" />
                        <TextBox Text="{Binding Path=Value, Mode=OneWay}" 
                        Width="300px">
                        </TextBox>
                    </WrapPanel>
                </DataTemplate>
            </ItemsControl.Resources>
        </ItemsControl>
    <!--</ScrollViewer>-->

Any pointers?

Bonus point: Where should I add a ScrollViewer in order to have the behavior shown in my mockup?

Thanks a lot!

  • 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-28T21:27:39+00:00Added an answer on May 28, 2026 at 9:27 pm

    The WrapPanel has, as well as the StackPanel, an Orientation property, which defaults to Vertical. So your list should wrap (assuming you have enough space at hand) if your ItemsPanelTemplate looks like this:

    <ItemsPanelTemplate>
        <WrapPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
    

    About the ScrollViewer:

    The desired behavior should be achieved by defining it like follows (not tested though, and I omitted all for this example unnecessary stuff):

    <ScrollViewer HorizontalAlignment="Stretch">
        <ItemsControl MinWidth="550" Width="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}" />
    </ScrollViewer>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to bind controls in a WPF form to an interface and I
I'm trying to create a pretty simple WPF interface, and from what I know
I am trying to replicate a remote like directional interface in WPF on Windows
I am trying to use a Serial Port to interface with a camera. Now,
Since I am trying to learn WPF I see more and more the use
I'm trying to interface a c++ member function with a legacy C library taking
I'm trying to implement validation in my WPF application using the IDataErrorInfo interface, and
I'm trying to create a simple media player interface using WPF. Though I'm a
I'm trying to build a WPF user interface containing a TabControl, and a TextBlock.
I'm trying to interface with the Google Docs APIs, namely the Google Documents List

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.