简体   繁体   中英

wpf horizontalalignment left and stretch?

I Want to change border size to parent's size, but only grow to Maximum size.

If height and width is under 50 then horizontal and vertiacl will be stretched. But after it reach to 50, it changes to center with height and width size 50 fixed

Forexample if it reached to 50, it looks like this

|  □  |

But What i want is this

|ㅁ   |

My xaml code here

<Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  MaxHeight="50" MaxWidth="50">

Thanks, Shubham Sahu's answer helped me

<Grid.ColumnDefinitions>
   <ColumnDefinition Width="1*" MaxWidth="10"/>
   <ColumnDefinition Width="4*" MaxWidth="60"/>
   <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>

Setting MaxWidth to Column definition solved this problem!

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