How to add wpf control to particular grid row and cell during runtime?

前端 未结 2 1635
伪装坚强ぢ
伪装坚强ぢ 2020-12-15 05:15

I have the following grid in my WPF \"Window\" (yes the class Window);


            
                 


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 05:50

    • Create the grid () and the Row Definitions like you have done.
    • Create The Control (). Then Set The ColumnSpan and Row for the Grid:

      Grid.SetColumnSpan(, 3); Grid.SetRow(, 0);

    • Then add your control to the grid you have created

      .Children.Add();

提交回复
热议问题