我在主窗口中的以下Grid
:WPF电网未拉伸垂直
<Grid Name="gridMain" Width="Auto" VerticalAlignment="Stretch" Height="Auto">
</Grid>
我在动态网格添加UserControl
。主窗口只有这个网格。我希望网格水平和垂直拉伸,并应填满整个窗口。网格水平拉伸,但不垂直拉伸。任何想法为什么?我需要做些什么来使网格垂直拉伸?
编辑
这里是完整的XAML。
<Window x:Class="Sensitech.TurboValidator.UserControls.ConveyorBelt"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ConveyorBelt" Height="329" Width="714" xmlns:my="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
<Grid Name="gridMain" Width="Auto" VerticalAlignment="Stretch" Height="Auto" Background="Cyan">
</Grid>
</Window>
我只是把你的'Xaml'放到Wpf应用程序中,并给它一个背景色。它工作没有问题。 ** gridMain **是根'Xaml'对象吗? – 2011-12-27 06:07:34
@MarkHall:不,它不是根对象。请检查我的编辑。 – Donotalo 2011-12-27 06:27:52