我总是遇到在windows phone中定位元素的问题。希望有人能帮助我: 我有一个列表框dinamically从代码populatem背后:在ItemTemplate中定位文本 - Windows Phone 8
<ListBox Name="list" Grid.Row="1" HorizontalAlignment="Center">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" Style="{StaticResource list_service_item}"/>
</DataTemplate>
</ListBox.ItemTemplate>
风格在App.xaml中定义:
<Style x:Key="list_service_item" TargetType="TextBlock">
<Setter Property="FontSize" Value="25"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="Peru" />
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0 0 0 5"/>
</Style>
貌似除了正常工作对齐属性。
如果列表框项具有相同的长度一切运作良好,但是,如果他们中的一个较长所有其他赞同的长项的开始,而不是保持居中:
如何我能解决这个问题吗?
你肯定* *,他们正在调整到较长的项目开始而不仅仅是集中,而是巧合地与长项目的开始排队?你能向我们展示一张图片吗? – Sheridan
这是一个[截图](http://i338.photobucket.com/albums/n430/jack_the_beast/items.png) –