後面我要訪問列表框的selectedItem屬性我有包括列表框WP7 - 在列表框中訪問選擇項目時列表框是一個ItemTemplate
<controls:Pivot x:Name="MainPivot" ItemsSource="{Binding PivotItemHeaders}" Title="CLASS TIMETABLE" >
<controls:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Description}"/>
</DataTemplate>
</controls:Pivot.HeaderTemplate>
<controls:Pivot.ItemTemplate>
<DataTemplate>
<ListBox x:Name="Events" ItemsSource="{Binding allEventItems}" ItemTemplate="{StaticResource EventDisplay2}"/>
</DataTemplate>
</controls:Pivot.ItemTemplate>
</controls:Pivot>
代碼中的一個樞軸項模板內,但我不能'得到」到ListBox這樣,因爲兩者均是(大概)模板
即
this.NavigationService.Navigate(new Uri("/View/EventEdit.xaml?selectedEvent=" + Events.SelectedItem, UriKind.Relative));
的活動列表框不被認可的範圍內。
Assuminh我可以通過獲取對象,並通過將它作爲一個參數,我可以用什麼代碼來檢索它
我知道它與 保護覆蓋無效的OnNavigatedTo(NavigationEventArgs E)開始 { 如果( NavigationContext.QueryString.ContainsKey(「SelectedEvent」)){
但我不能確定的語法/代碼從參數中提取出來的對象
欣賞我怎麼能得到selecte dItem從這個列表框和代碼打通
- 感謝
好的 - 謝謝我不確定我是否可以傳遞對象。 – Peter 2011-06-16 06:25:45
因此,您建議我捕獲已選擇的最新項目(通過SelectionChanged事件),然後在我想導航的時候,從此對象獲取密鑰並將其傳遞。 – Peter 2011-06-16 06:27:55
這是正確的。 – 2011-06-16 09:23:48