9
我有一个底座面板,中间有一个标签,最右侧有另一个按钮。将标签对齐到底座面板中间
由于按钮标签无法对齐到窗口最大化时的中间位置。
WPF:
<DockPanel Height="40" HorizontalAlignment="Stretch" Margin="-1,-2,0,0" Name="dockPanel1" VerticalAlignment="Stretch" Width="Auto" OpacityMask="{x:Null}">
<Label FontSize="18" Content="Sales" FontWeight="Bold" FontFamily="Arial" Width="883" Height="42" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Foreground="White" DockPanel.Dock="Left" VerticalAlignment="Center" VerticalContentAlignment="Center"></Label>
<Button FontSize="18" Height="47" Width="123" Name="btnStart" Foreground="White" BorderBrush="{x:Null}" FlowDirection="LeftToRight" HorizontalContentAlignment="Center" FontFamily="Arial Rounded MT" ClickMode="Press" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="0" Content="Start" BorderThickness="0" Focusable="False">
</DockPanel>
DockPanel是不是这个合适的容器 –
您是否尝试制作三列网格并将标签放在中间列的中间,并在右边的按钮右栏? – paul
我喜欢你的解决方案保罗。 DockPanel显然不是正确的控制,但这不是正确的答案。它可能不是一个替代它的选项。 –