Lalith
Lalith

Reputation: 20554

Getting ListBox Items Silverlight

I have tried to get the listbox items using VisualTreeHelper class. When I do VisualTreeHelper.GetChildrenCount((DependencyProperty)listBox1) it returns count as 0. But the listbox has lot of listboxitems in it.Can someone let me know if I am doing any mistake?

Regards, Lalith

Upvotes: 1

Views: 645

Answers (1)

John Thiriet
John Thiriet

Reputation: 76

Have you tried to use the ItemContainerGenerator property of the Listbox class ? It has some methods you can use to retrieve Listbox items. http://msdn.microsoft.com/en-US/library/system.windows.controls.itemscontrol.itemcontainergenerator(v=VS.95).aspx

Upvotes: 1

Related Questions