在Grid里对一个TextBox定位
XML
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Background="LightBlue" Grid.Column="1" Grid.Row="1"/>
</Grid>
在Canvas里放入TextBox
XML
<Canvas Margin="10">
<TextBox Background="LightPink" Width="200" Canvas.Top="0"/>
<TextBox Background="LightPink" Width="200" Canvas.Top="30"/>
<TextBox Background="LightPink" Width="200" Canvas.Top="60"/>
</Canvas>
在DockPanel里放TextBox
XML
<DockPanel LastChildFill="False">
<TextBlock Background="LightSteelBlue" DockPanel.Dock="Top"/>
<TextBlock Background="LightSteelBlue" DockPanel.Dock="Bottom"/>
<TextBlock Background="LightPink" Width="80" DockPanel.Dock="Left"/>
<TextBlock Background="LightPink" Width="80" DockPanel.Dock="Right"/>
</DockPanel>
在StackPanel中放入TextBox
XML
<StackPanel Margin="10,5">
<TextBlock Background="LightPink" Margin="0,5"/>
<TextBlock Background="LightPink" Margin="0,5"/>
<TextBlock Background="LightPink" Margin="0,5"/>
</StackPanel>