I'm trying to iterate through my Treeview, expanding all nodes however it runs into an InvalidCastException when ran;
Unable to cast object of type 'System.Data.DataRowView' to type 'System.Windows.Controls.TreeViewItem'.
My Code;
foreach (TreeViewItem treeitem in thetreeView.Items)
{
treeitem.IsExpanded = true;
}
Any ideas? I want to fire this from a button.