我想知道我是否可以在水平方向的 StackPanel 中有 2 个控件,以便正确的项目应该停靠在 StackPanel 的右侧。
我尝试了以下但没有奏效:
<StackPanel Orientation="Horizontal">
<TextBlock>Left</TextBlock>
<Button Width="30" HorizontalAlignment="Right">Right<Button>
</StackPanel>
在上面的代码片段中,我希望 Button 停靠在 StackPanel 的右侧。
注意:我需要使用 StackPanel,而不是 Grid 等来完成。