C# WPF how to set location,width and height of the controls programmatically?

后端 未结 6 1219
慢半拍i
慢半拍i 2021-01-01 23:14

I\'m doing my first WPF application. im having problem whereby when my form is maximized or fullscreen, my controls wont resize and just stay in the same location. only the

6条回答
  •  迷失自我
    2021-01-01 23:25

    To set Width and Height:

    dockpanel1.width = 230;
    dockpanel1.height = 230;
    

    as for location, wpf uses Margin:

    dockpanel1.Margin = new Thickness(0,440,836,40);
    

提交回复
热议问题