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

  • SEARCH
  • Home
  • 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 7436415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:14:10+00:00 2026-05-29T10:14:10+00:00

I got a ListView (wrapped in a ScrollViewer), which resizes itself if the elements

  • 0

I got a ListView (wrapped in a ScrollViewer), which resizes itself if the elements inseretd exceed the visible area until the parents Max Height is reached.

The ListView is embedded the following way.

<Window ... SizeToContent="Height">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="2*" />                              
        </Grid.ColumnDefinitions>

        <ScrollViewer x:Name="MyScrollViewer" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <ListView   Name="MyListView" 
                        ItemsSource="{Binding Path=RetrievalStringResults, Mode=OneWay}" 
                        IsSynchronizedWithCurrentItem="True" />
        </ScrollViewer>

         <DockPanel Grid.Row="0" Grid.Column="1">
         ...
         </DockPanel>

         <Expander Grid.Row="1" Grid.ColumnSpan="2">
             <DockPanel Height="150"  HorizontalAlignment="Stretch">
                <TextBox DockPanel.Dock="Top" />
             </DockPanel>
         </Expander>

         <DockPanel Grid.Row="2" Grid.ColumnSpan="2">
         ... some buttons
         </DockPanel>
    </Grid>
</Window>

I used SizeToContent because I got a text box on the bottom wrapped in an Expander, which shall expanded on demand, and actually therefore my main window needs to resize. This actually works fine.

The problem is though the ListView’s Height isn’t the max height on start-up wherefore I got that “auto-resize” effect.

How can I set the ListView’s hight to the max of the parents height to avoid this effect?

Another, more general issue. I think avoiding static layout parameters (static values for hight/width) is nice, but I got the feeling I’m loosing some control over my UI controls.

I recognized, resizeing my main window manually in height, it “jumps” by the 150 height of the DockPanel wrapped by the Expander on the bottom, anyway to avoid this?

What is the best pratice in dynamic UI Layout? I explored DockPanel beeing more dynamically in sizing to the surounding contorls than a StackPanel. But I guess thats not everything.

  • 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-29T10:14:10+00:00Added an answer on May 29, 2026 at 10:14 am

    I think your issue is with your Grid definitions

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
    
        ...
    
    </Grid>
    

    This means that the top row is going to be twice the size of rows 2 and 3, so the top row will only take up 50% of your space while your bottom two rows each take up 25% space.

    If you want the top row to take up all available space, make sure it is the only * size row, and set the other rows to Auto so they will take up whatever space they need.

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
    
        ...
    
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´ve got a ListView which is bound to the ObservableCollection mPersonList. The Class Person
I've got a simple ListView which pulls data from an ObservableCollection and I'm using
I've got a listbox from which I'm dragging into the ListView. Now I have
I got this ListView which is populated from a JSON data on the web.
I got a custom listview which contains info about tv shows, ie. show title,
What I try to do I got a ListView which I've filled over my
I have one listview in which i am displaying data that i got, it
I've got a ListView control in Details mode with a single column. It's on
In my View I got a ListView bound to a CollectionView in my ViewModel,
It seems like this should be straightforward but I'm boggling. I've got my listview

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.