我正在开发window phone 7应用程序。我的应用程序中有一个列表框。我正在使用该列表框进行动态绑定。列表框的代码如下:如何在列表框的文本块上添加点击事件?
<ListBox x:Name="FirstListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432">
<TextBlock Text="{Binding ID}" Width="440"></TextBlock>
<TextBlock Text="{Binding IsCompany}" Width="440"></TextBlock>
<TextBlock Foreground="Red" Text="{Binding CompanyORIndividual}" Width="440"></TextBlock>
<TextBlock Text="{Binding MicrosoftContact}" Width="440"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.Template>
<ControlTemplate>
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
</ListBox>
此列表框位于pivot控件中。我想将链接或点击事件添加到以下文本块中。
<TextBlock Foreground="Red" Text="{Binding CompanyORIndividual}" Width="440"></TextBlock>
因此,在点击CompanyORIndividualblocks后,用户应该被导航到另一个xaml页面。这个怎么做。你能否给我提供事件处理程序的代码?你能否提供我可以通过哪些代码或链接来解决上述问题?如果我做错了任何事情,请指导我。如果有比我上面的问题更好的主意,那么请提出建议。
你真的把一个水平滚动列表框内的PivotItem?这可能会导致列表框上的手势问题被误解为数据透视表上的手势,反之亦然。这是通常不推荐的,你应该用实际的用户进行彻底的测试。 – 2011-04-29 17:58:25