WPF Auto height in code

后端 未结 2 1330
孤街浪徒
孤街浪徒 2021-01-31 23:58

How could I set the value of the Height property of a WPF control in C# code to \"Auto\"?


    

        
2条回答
  •  终归单人心
    2021-02-01 00:44

    You can use

    RowDefinition rd = new RowDefinition();  
    rd.Height = GridLength.Auto;  
    ContentGrid.RowDefinitions.Add(rd);
    

提交回复
热议问题