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

Ask A Question

Stats

  • Questions 167k
  • Answers 167k
  • 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
  • Editorial Team
    Editorial Team added an answer The conflict could happen, because SQL-Server does locking not only… May 12, 2026 at 1:32 pm
  • Editorial Team
    Editorial Team added an answer You can use the getXpathCount command to determine the number… May 12, 2026 at 1:32 pm
  • Editorial Team
    Editorial Team added an answer int nextWeight = db.TableWithWeights.Max(p => p.Weight) + 1; May 12, 2026 at 1:32 pm

Related Questions

I've just spent a very frustrating afternoon trawling Google looking for a commercial-grade WPF
WPF document viewing controls that support annotations include FlowDocumentReader and FlowDocumentScrollViewer, as well as
My name is Jesús from Spain, I'm a .NET developer and I just discovered
I want to produce some library code that will be included into WPF applications.

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.