获取列表框项目Silverlight
问题描述:
我试图使用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