The RadTreeViewItem has internal coercing logic which checks whether the item to be expanded has any children:
protected internal virtual void OnIsExpandedChanged(bool oldValue, bool newValue)
.Items.Count == 0)
RadTreeView gives you the ability to expand an item manually by clicking the expander button of the RadTreeViewItem because the IsLoadOnDemandEnabled is set to True. This also gives you the option to add child items on this expand. There are two possible results with such scenario:
-- you expand such item and do not add children (this is what happens in your project on expanding sub item). The result is - the treeview sets IsEsxpanded to true, then it coerces the value back to false because there are no children ( the code from the snippet above kicks in). The expander button is collapsed.
-- you expand such item and set children, for example:
The RadTreeViewItem stays with IsExpanded True and the Expander button is shown as expanded.
Our advice for you is to set IsLoadOnDemandEnabled
on RadTreeViewItem level (you can do it via style) and this way you can have expander button only for the items that will receive children from your code.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.