我正在開發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