MrBilly222
MrBilly222

Reputation: 65

C# WPF Dynamic Scaling with MinHight/MinWidth Set to Auto

The title pretty much describes what I am looking for. I have found answers that are close but not quite what I need. I am hoping someone can explain how to do this or point me in the right direction.

Current setup: I have multiple user controls. Each contain a grid that has 5 rows and 3 columns. First row definition is set to Height="Auto" and the rest are Height="". First column definition is set to Width="Auto" and the others are set to Width="". I do not want the first row and first column to ever change size but I would like to have the rest of the grid scale.

Question: I am trying to create a window, which contains a grid, that will dynamically size. The grid contains user controls stated above and each row and column in the window is set to *. I do not want any element in the window to size below what is required for the inner controls (i.e. I do want a button control change sizes but it should never become smaller then Auto width or height). Is there a way to allow for this scalability but do not get any smaller then what the controls requires (ideally within the xaml)?

I don't remember the exact CSS syntax, but I was hoping xaml had something similar to the way CSS sizes content equal to the size of characters on the screen (i.e. Min-Width: 1.5m;)

Upvotes: 0

Views: 627

Answers (1)

Jonah Kunz
Jonah Kunz

Reputation: 670

If you wanted the first row and column to be a static size then don't set them to auto, set the actual size then for the rest of the columns/rows you could use * so they all remain equal

Upvotes: 0

Related Questions