开发者

Setting ColumnDefinitions in code

开发者 https://www.devze.com 2023-02-23 12:06 出处:网络
I\'m wondering if there is a way to set a ColumnDefinition 开发者_开发百科Width to * in code, like you can in the xaml file. When trying to set in code GridLength just has the Auto has an option.

I'm wondering if there is a way to set a ColumnDefinition 开发者_开发百科Width to * in code, like you can in the xaml file. When trying to set in code GridLength just has the Auto has an option.

<ColumnDefinition Width="*"/>

Thanks for any help.


You will need to create an instance of the GridLength data type and specify GridUnitType.Star

col.Width = new GridLength(1, GridUnitType.Star);
0

精彩评论

暂无评论...
验证码 换一张
取 消