This question is locked. New answers and comments are not allowed.
In my RadTree, there is a node that I need to be checked when the view initially shown. I have been able to accomplish this part, but I have not been able to expand all of its parents. For the parents, I have been able to set their checked state to intermediate and calling BringToView, but the parents are still not expanding.
I'm subscribing to the ItemPrepared event to select the checked state of the child and parents.
Wouldn't a method to expand the note be easier? Item.Expand()
Also, I've read in other posts that you have to wait until the Items have been loaded, that makes sense, but what event do you subscribe to that lets you know that the items have been loaded? ItemsLoaded event? or Items.CollectionChanged?
xaml
I'm subscribing to the ItemPrepared event to select the checked state of the child and parents.
Wouldn't a method to expand the note be easier? Item.Expand()
Also, I've read in other posts that you have to wait until the Items have been loaded, that makes sense, but what event do you subscribe to that lets you know that the items have been loaded? ItemsLoaded event? or Items.CollectionChanged?
xaml
<
telerik:ContainerBindingCollection
x:Key
=
"TreeViewItemContainerBinding"
>
<
telerik:ContainerBinding
PropertyName
=
"IsExpanded"
Binding
=
"{Binding Path=IsActive, Mode=TwoWay}"
/>
<
telerik:ContainerBinding
PropertyName
=
"IsSelected"
Binding
=
"{Binding Path=IsActive}"
/>
</
telerik:ContainerBindingCollection
>
<telerik:HierarchicalDataTemplate x:Key="OrgUnitsItemTemplate" ItemsSource="{Binding OrgUnits}"
telerik:ContainerBinding.ContainerBindings ="{StaticResource TreeViewItemContainerBinding}">
<StackPanel Orientation="Horizontal">
<telerik:Label Content="{Binding ParentOrgUnit.Description}" />
</StackPanel>
</telerik:HierarchicalDataTemplate>
void
UxOrgUnitsItemPrepared(
object
sender, RadTreeViewItemPreparedEventArgs e)
{
var item = e.PreparedItem.Item
as
OrgUnitHierarchy;
if
(item ==
null
|| item.ParentOrgUnit.OrgUnitId != Dto.CurrentOrgUnitId)
return
;
e.PreparedItem.CheckState = ToggleState.On;
var parentItem = e.PreparedItem.ParentItem;
while
(parentItem !=
null
)
{
parentItem.CheckState = ToggleState.Indeterminate;
parentItem.IsExpanded =
true
;
parentItem = parentItem.ParentItem;
}
}