以下代码将两个文本元素放在顶部,即使第二个被标记为“底部”。背景颜色一直到底部,因此 DockPanel 似乎延伸到底部。
我对 DockPanel 有什么不了解的地方?
<Window x:Class="TestIndexer934.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:TestIndexer934.Commands"
Title="Main Window" Height="400" Width="800">
<DockPanel HorizontalAlignment="Left" Background="Beige">
<TextBlock DockPanel.Dock="Top" Text="Testing top"/>
<TextBlock DockPanel.Dock="Bottom" Text="Testing bottom"/>
</DockPanel>
</Window>