I am using a RadTreeListView and I want to have certain nodes (based on object type) expanded the first time they are loaded. I have tried several ways to do this but they all seem to have issues. I think most of the issues have to do with the fact that the row is not actually created or loaded at the time I try to expand it. I found the example used to expand all rows and that works but my tree is way to big to do that all the time.
My current approach is to handle the RowLoaded event and if the e.DataElement meets the criteria call TreeListView.ExpandHierarchyItem(e.DataElement). This actually works except the TreeListView is initially blank (except with a scrollbar on the bottom). If I click the scoll bar the tree shows up (and the scroll bar goes away). The other issue with this is that if one of the expanded nodes is a child of a node that is not expanded the whole tree disappears never to return.
Here is my RowLoaded event handler (not terribly complicated).
private void TreeView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
if ((e.DataElement != null) && (e.Row is GridViewRow) && !(e.Row is GridViewNewRow))
if (e.DataElement is myObjectType)
Is there a better way to do this?