我有下面的xaml
代码。我正在尝试将图像和textblock
右侧对齐。第一个textblock
显示正确,我只想要最右边的image
第二个。我怎样才能正确对齐?textblock
dock
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" BorderThickness="0" Padding="16,2"
BorderBrush="Transparent" Background="{StaticResource AccentBrush}">
<DockPanel LastChildFill="True">
<ItemsControl ItemsSource="{Binding Lists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Margin="0,5" FontSize="24" FontFamily="Sageo UI Light" TextAlignment="Left" TextWrapping="NoWrap"
TextTrimming="WordEllipsis" Foreground="{StaticResource MainBrush}" HorizontalAlignment="Stretch" Text="{Binding Title}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel Orientation="Horizontal" >
<Image HorizontalAlignment="Right" Source="/Images/image.png"/>
<TextBlock DockPanel.Dock="Right" Margin="16,0,0,0" Text="{Binding ElementName=TreeView, Path=SelectedItem.Name, StringFormat='Name: {0}'}"
FontFamily="Segoe UI Light" FontSize="14" TextAlignment="Right" TextWrapping="NoWrap" TextTrimming="WordEllipsis"
Foreground="{StaticResource MainBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
</StackPanel>
</DockPanel>
</Border>