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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:46:22+00:00 2026-05-13T06:46:22+00:00

Can someone help me understand the WPF stretch alignment. I often run into issues

  • 0

Can someone help me understand the WPF stretch alignment. I often run into issues where I want a control to fill an area but I never understand on what level I should put the VerticalAlignment=”Stretch”. Specially when UserControls are involved.

I always solve the problem by trying different things or putting stretch on all levels but I would like to understand how to do it properly.

Lets take the example I got now:

  • I have a grid with a fixed size cell (which can be resized with a GridSplitter)
  • In this cell I have a UserControl containing a StackPanel with a TabControl
  • In the TabControl I have TabItems containing another UserControl with a ListView

Or in some kind of pseudo XAML

<ns:MyUserControl1 Grid.Row="0" Grid.Column="0">
    <!-- this is in MyUserControl1 -->
    <StackPanel>
        <TabControl>
            <TabItem>
               <ns:MyUserControl2>
                    <!-- This is in MyUserControl2 -->
                    <ListView/>
               </ns:MyUserControl2>
            </TabItem>
        </TabControl>
    </StackPanel>
</ns:MyUserControl>

Now I want the ListView to fill the entire grid cell (excluding the TabControl and margins of course).

  • 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-13T06:46:22+00:00Added an answer on May 13, 2026 at 6:46 am

    Your ListView will fill your MyUserControl2 – if you want this to fit within the whole Tab, you’ll need to make sure you remove the Height and Width constraints within the UserControl’s xaml file (these will default to 300 each)

    EDIT: Apologies – I skipped the important part of your xaml… The MyUserControl1 container is a StackPanel… this will stack child controls and resize to fit them; If you replace it with a DockPanel (or a Grid), the child controls will fill the available space and give you the result you are after…

    Have a look at this msdn article… Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

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

Top Members

Related Questions

I know this regex divides a text into sentences. Can someone help me understand
Can someone help me understand how best to model a composition relationship? If for
Can someone help me understand variable/function inheritance in PHP classes. My parent class has
Can someone help me identify what the purpose of this unidentified syntax is. It
Can someone help me figure out the following make file? BINS=file1 file2 file3 all:
Can someone help explain the following: If I type: a=`ls -l` Then the output
Can someone help me with the getopt function? When I do the following in
Can someone just help me refresh my mind? How do you specify hex values
Can someone please help me out with printing the contents of an IFrame via
I am wondering if someone can help me figure out the best approach to

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.