wpf如何自动调整窗口大小以适合其内容

// Manually alter window height and width

this.SizeToContent = SizeToContent.Manual;

// Automatically resize width relative to content

this.SizeToContent = SizeToContent.Width;

// Automatically resize height relative to content

this.SizeToContent = SizeToContent.Height;

// Automatically resize height and width relative to content

this.SizeToContent = SizeToContent.WidthAndHeight;

原文地址:https://www.cnblogs.com/zhangtao/p/2347533.html