【发布时间】:2018-01-19 22:02:23
【问题描述】:
我有一个简单的 WPF UserControl,如下所示。
我不明白为什么这段代码没有将绿色网格固定到 DockPanel 的底部:
如果我在两个块之间添加一些东西,那么绿色将固定在底部:
下面是简单的代码:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:tWorks.Alfa.OperatorClient.UserControls.Vehicles"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" x:Class="tWorks.Alfa.OperatorClient.UserControls.Vehicles.Misc_Vehicles_GpsTrackBarContext"
mc:Ignorable="d"
d:DesignHeight="260" d:DesignWidth="450">
<DockPanel>
<Grid DockPanel.Dock="Top" Height="50" Background="Red"></Grid>
<Grid DockPanel.Dock="Bottom" Height="50" Background="Green"></Grid>
<Grid Height="50" Background="Blue"></Grid>
</DockPanel>
</UserControl>
【问题讨论】: