开发者

How add columns to a row in Grid in wpf

开发者 https://www.devze.com 2023-01-29 09:19 出处:网络
I have a MainGrid in Wpf (not a DataGrid) it has 3 rows(0.1 and 2) i have made rows using xaml at design time now at run time behind a menu button i wantto add 2 column to row 1 of the main grid.

I have a MainGrid in Wpf (not a DataGrid) it has 3 rows(0.1 and 2) i have made rows using xaml at design time now at run time behind a menu button i want to add 2 column to row 1 of the main grid.

The hard par开发者_如何学Pythont is that only break the row 1 into 2 columnn and not the whole Grid.

i know that to add new rows and columns one can use rowdefination and columndefination but

couldnt find anything here:

 MainGrid.RowDefinitions.ElementAt(1).SetValue...;

Thanks


Why don't you add a Grid with 1 row and 2 columns to that row instead. And put your contents in that Grid. That will be easier.


make the column span = 2 for all the controls that you add in row 2 and 3...

0

精彩评论

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