我正在尝试对齐文本块中心,但文本左对齐。
<TextBlock Text="{Binding Name}" Height="22" Width="192" />
请帮助调整中心。代码块如下
<ListView x:Name="listview" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.ZoomMode="Enabled"
ItemsSource="{Binding Path=YourCollection}"
GotFocus="StackPanel_GotFocus" IsItemClickEnabled="True" ItemClick="ListView_ItemClick" Margin="144,360,45,0" Style="{StaticResource ListViewStyle1}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Height="130" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate >
<DataTemplate>
<StackPanel Orientation="Vertical" Height="130" Width="200" >
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image}" Height="108" Width="192" />
</StackPanel>
<StackPanel Orientation="Vertical" >
<TextBlock Text="{Binding Name}" Height="22" Width="192" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>