I am adding nodes to a Treeview in the code behind like so:
private void CreateTreeviewNodes(Applications apps) |
{ |
RadTreeListViewItem rootItem; |
RadTreeListViewItem queriesItem; |
RadTreeListViewItem queriesWorklistItem; |
RadTreeListViewItem queriesNewQueryItem; |
rootItem = new RadTreeListViewItem(); |
rootItem.Header = "My Dashboard"; |
rootItem.Foreground = new SolidColorBrush(Colors.Black); |
rootItem.Selected += new EventHandler<RadRoutedEventArgs>(searchTreeView_RootItemSelected); |
searchTreeView.Items.Add(rootItem); |
for (int i = 0; i < apps.Count; i++) |
{ |
rootItem = new RadTreeListViewItem(); |
rootItem.Header = apps[i].Name; |
rootItem.Foreground = new SolidColorBrush(Colors.Black); |
rootItem.Selected += new EventHandler<RadRoutedEventArgs>(searchTreeView_RootItemSelected); |
searchTreeView.Items.Add(rootItem); |
queriesItem = new RadTreeListViewItem(); |
queriesItem.Header = "Queries"; |
rootItem.Foreground = new SolidColorBrush(Colors.Black); |
queriesItem.Selected += new EventHandler<RadRoutedEventArgs>(searchTreeView_QueriesItemSelected); |
rootItem.Items.Add(queriesItem); |
queriesWorklistItem = new RadTreeListViewItem(); |
queriesWorklistItem.Header = "Worklist"; |
rootItem.Foreground = new SolidColorBrush(Colors.Black); |
queriesItem.Selected += new EventHandler<RadRoutedEventArgs>(searchTreeView_QueriesWorklistItemSelected); |
queriesItem.Items.Add(queriesWorklistItem); |
queriesNewQueryItem = new RadTreeListViewItem(); |
queriesNewQueryItem.Header = "New Query"; |
rootItem.Foreground = new SolidColorBrush(Colors.Black); |
queriesNewQueryItem.Selected += new EventHandler<RadRoutedEventArgs>(searchTreeView_QueriesNewQueryItemSelected); |
queriesItem.Items.Add(queriesNewQueryItem); |
} |
} |
When I execute my code, however, the text on the RadTreeViewItems does not display until I select an item. If I then select another node its text displays but the text of the previously selected item disappears. Attached is a screenshot of the issue.
Can anyone tell me what is causing this or what I am doing wrong?
Thanks.