我相信这个问题一定有简单的解释,但是我似乎找不到它。从下面的代码来看,为什么我的文本框会超出窗口范围?我认为如果将它们的宽度设置为窗口大小,它们应该可以完美对齐...然而运行时却明显不是这种情况。我错过了什么?设置宽度的正确方法是什么?
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="300" Width="200">
<StackPanel Orientation="Horizontal">
<TextBox Width="100">Hello</TextBox>
<TextBox Width="100" TextAlignment="Right">World</TextBox>
</StackPanel>
</Window>