【发布时间】:2023-03-15 06:30:01
【问题描述】:
我想将两个标签放在一行中,第一个与左边框对齐,第二个与右边框对齐。
喜欢这里:
这是我的 XAML 尝试:
<Window x:Class="MyTestNamespace.MyXAML"
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">
<DockPanel>
<Label Content="left text" DockPanel.Dock="Left"></Label>
<Label Content="right text" DockPanel.Dock="Right"></Label>
</DockPanel>
</Window>
但是我得到了这个:
- 我在使用 DockPanel 时做错了什么?
- 如何实现第一张图片的设计(不一定要用DockPanel)?
【问题讨论】:
标签: wpf xaml alignment dockpanel