在WPF扩展器头中对齐TexBlocks,可以通过以下几个步骤实现:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<WrapPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="TextBlock1" Margin="5"/>
<TextBlock Text="TextBlock2" Margin="5"/>
<TextBlock Text="TextBlock3" Margin="5"/>
</WrapPanel>
</Grid>
</Window>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0" LastChildFill="False">
<TextBlock Text="TextBlock1" Dock="Right" Margin="5"/>
<TextBlock Text="TextBlock2" Dock="Right" Margin="5"/>
<TextBlock Text="TextBlock3" Dock="Right" Margin="5"/>
</DockPanel>
</Grid>
</Window>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="TextBlock1" Margin="5"/>
<TextBlock Text="TextBlock2" Margin="5"/>
<TextBlock Text="TextBlock3" Margin="5"/>
</StackPanel>
</Grid>
</Window>
以上是在WPF扩展器头中对齐TexBlocks的方法,可以根据需要选择不同的布局控件和设置来实现对齐。
领取专属 10元无门槛券
手把手带您无忧上云