0
大約三個小時,我一直在嘗試獲取多選列表框的選定索引。我嘗試了各種解決方案,但他們不工作。我發現的最後一件事是:Windows Phone MultiSelect列表框選定的項目
for (int i = 0; i < this.myListBox.Items.Count; i++)
{
ListBoxItem currentItem = this.myListBox.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
if (currentItem != null && currentItem.IsSelected)
{
ApplicationManager.Instance.getContactManager().addToIndexes(i);
}
}
這似乎工作,但當我在列表中向下滾動例如,先前選定項目的listboxitem返回null。我怎樣才能完成這項任務?
你可以使用選定的idex列表框它會爲你工作 – MansinhDodiya