简体   繁体   中英

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 (ie 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 (ie Min-Width: 1.5m;)

如果您希望第一行和第一列为静态大小,则不要将它们设置为自动大小,而是设置实际大小,然后对于其余的列/行可以使用*,以便它们都保持相等

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM