2012-10-23 62 views
2

下面是一个非常简单的WPF窗口的XAML代码:使得SizeToContent拿冠军到

<Window x:Class="TitleTester.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="Long, verbose, unabridged title" SizeToContent="WidthAndHeight"> 
    <Grid> 
     <Label>Short text</Label> 
    </Grid> 
</Window> 

当我打开这个窗口,文本Short text完全显示;但是,标题栏仅显示L...Long, verbose, unabridged title的第一个字母)。我希望打开的窗口足够宽以显示完整的标题,并且不会更宽。有没有办法做到这一点?

回答