Setting ColumnDefinitions in code

*爱你&永不变心* 提交于 2019-12-10 12:29:00

问题


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.


回答1:


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

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


来源:https://stackoverflow.com/questions/5586563/setting-columndefinitions-in-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!