代码改变世界

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

2011-07-18 23:45  观海看云  阅读(571)  评论(0编辑  收藏  举报

// 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;