我正在使用VS 2010 Express版windows phone的windows phone 7上工作。我有使用wrappanel製作的圖像網格。當我選擇任何項目或圖像時,我想要點擊的圖像的id。同樣有一個列表框,當任何列表項點擊時,我再次想要文本塊的值單擊即文本。 我使用列表框項目選擇這種方法,一個想在這裏的ID:無法獲取網格或列表項目中點擊的項目的索引
private void on_selection(object sender, SelectionChangedEventArgs e)
{
//want id of clicked item here
}
void grid_image_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
//want id of clicked image in grid here
}
任何建議都歡迎。
的XML列表框是:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="768"/>
<RowDefinition Height="0*" />
</Grid.RowDefinitions>
<ListBox Name="Index_list" SelectionChanged="on_selection">
</ListBox>
<Image Visibility="Collapsed" Margin="0,151,0,200" Name="selected_image"></Image>
</Grid>
wrappanel沒有選擇的事件和圖像不具有`ID`財產。你可以請張貼顯示你想要做什麼的XAML? – 2011-01-11 09:14:04
更新了我的問題.. – Shaireen 2011-01-11 09:51:20
感謝您添加XAML,並且我提供了一個答案,但是您仍然不會顯示wrappanel,「id」(您是指索引號?)還是什麼操作事件處理程序連接到。 – 2011-01-11 14:30:40