WPF根据窗口内容自动调整窗口大小
ResizeMode="NoResize"
Window.SizeToContent="Height"
<Grid x:Name="GridMain"
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.Height =
}
{
this.Height =
GridMain
.ActualHeight;}