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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:03:01+00:00 2026-05-10T14:03:01+00:00

Some WPF controls (like the Button ) seem to happily consume all the available

  • 0

Some WPF controls (like the Button) seem to happily consume all the available space in its’ container if you don’t specify the height it is to have.

And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more worried about just taking the space necessary to fit their contents, and no more.

If you put these guys in a cell in a UniformGrid, they will expand to fit the available space. However, UniformGrid instances are not right for all situations. What if you have a grid with some rows set to a * height to divide the height between itself and other * rows? What if you have a StackPanel and you have a Label, a List and a Button, how can you get the list to take up all the space not eaten by the label and the button?

I would think this would really be a basic layout requirement, but I can’t figure out how to get them to fill the space that they could (putting them in a DockPanel and setting it to fill also doesn’t work, it seems, since the DockPanel only takes up the space needed by its’ subcontrols).

A resizable GUI would be quite horrible if you had to play with Height, Width, MinHeight, MinWidth etc.

Can you bind your Height and Width properties to the grid cell you occupy? Or is there another way to do this?

  • 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. 2026-05-10T14:03:02+00:00Added an answer on May 10, 2026 at 2:03 pm

    Each control deriving from Panel implements distinct layout logic performed in Measure() and Arrange():

    • Measure() determines the size of the panel and each of its children
    • Arrange() determines the rectangle where each control renders

    The last child of the DockPanel fills the remaining space. You can disable this behavior by setting the LastChild property to false.

    The StackPanel asks each child for its desired size and then stacks them. The stack panel calls Measure() on each child, with an available size of Infinity and then uses the child’s desired size.

    A Grid occupies all available space, however, it will set each child to their desired size and then center them in the cell.

    You can implement your own layout logic by deriving from Panel and then overriding MeasureOverride() and ArrangeOverride().

    See this article for a simple example.

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

Sidebar

Related Questions

I have noticed that some WPF controls have some decent effects available to them
I really like some of the pre-built controls available in the Silverlight 4 Toolkit
We can make WPF Custom Control for overriding some control's look&feel, like icon button.
I would like to add some contextual menu to some controls a in WPF
Im using a WPF ScrollViewer to host some controls. I'd really like it to
I've read some of WPF/Silverlight controls, and I really liked some of them. One
I've got about three years c# experience. I'd like to learn some WPF and
I would like to make a library of some of my commonly used WPF
In WPF most controls have MouseUp and MouseDown events (and the mouse-button-specific variations) but
I see the majority of WPF Ribbon examples out there use some code like

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.