1
我試圖使用VisualTreeHelper類獲取列表框項目。當我做VisualTreeHelper.GetChildrenCount((DependencyProperty)listBox1)它返回計數爲0.但列表框中有很多listboxitems在裏面。有人讓我知道,如果我犯了什麼錯誤?獲取列表框項目Silverlight
問候, Lalith
我試圖使用VisualTreeHelper類獲取列表框項目。當我做VisualTreeHelper.GetChildrenCount((DependencyProperty)listBox1)它返回計數爲0.但列表框中有很多listboxitems在裏面。有人讓我知道,如果我犯了什麼錯誤?獲取列表框項目Silverlight
問候, Lalith
您是否嘗試過使用列表框類的ItemContainerGenerator財產?它有一些方法可以用來檢索列表框項目。 http://msdn.microsoft.com/en-US/library/system.windows.controls.itemscontrol.itemcontainergenerator(v=VS.95).aspx