WPF根据窗口内容自动调整窗口大小

ResizeMode="NoResize" Window.SizeToContent="Height"
<Grid x:Name="GridMain"
private void Window_Loaded(object sender, RoutedEventArgs e)
        {
           
            this.Height = GridMain.ActualHeight;
        }
posted @ 2021-05-23 19:08  microsoft-zhcn  阅读(462)  评论(0编辑  收藏  举报