I have a RadTreeView that is using hierarichal data template, and it is binded with thousands of records.
I am using UI Virtualization, to increase performance and the VirtualizationMode is standard.
In my case, i want to choose a group and highlight all children recursively, however it don't highlight all the children, and i guess this is due to the virtualization, as some of the children are not yet rendered.
This is my xaml tree code:
This is the C# Code of recursion selection :
Notes:
1-This code do not select all the children.
2-SelectedNode is of type RadTreeViewItem.
Thanks in advance
I am using UI Virtualization, to increase performance and the VirtualizationMode is standard.
In my case, i want to choose a group and highlight all children recursively, however it don't highlight all the children, and i guess this is due to the virtualization, as some of the children are not yet rendered.
This is my xaml tree code:
<
my:RadTreeView
Margin
=
"2,2,2,0"
IsLineEnabled
=
"True"
Name
=
"RadtreeView1"
IsVirtualizing
=
"True"
tree:TreeViewPanel.VirtualizationMode
=
"Hierarchical"
IsLoadOnDemandEnabled
=
"True"
TabIndex
=
"1"
telerik:TextSearch.TextPath
=
"Fields.Name"
IsDragDropEnabled
=
"False"
SelectionMode
=
"Multiple"
Background
=
"White"
KeyDown
=
"RadtreeView1_KeyDown"
Selected
=
"RadtreeView1_Selected"
ScrollViewer.VerticalScrollBarVisibility
=
"Visible"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
x:Name
=
"RadContext"
Opened
=
"RadContextMenu_Opened"
>
<
MenuItem
Header
=
"Select All Children"
Click
=
"MenuItem_Click"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
<
my:RadTreeView.ItemTemplate
>
<
HierarchicalDataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"{Binding Path=Fields.ImagePath}"
></
Image
>
<
TextBlock
Text
=
"{Binding Path=Fields.Code}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
Width
=
"50"
></
TextBlock
>
<
TextBlock
Text
=
" | "
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
></
TextBlock
>
<
TextBlock
Text
=
"{Binding Path=Fields.Name}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
Width
=
"200"
></
TextBlock
>
<
TextBlock
Text
=
" | "
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter} }"
></
TextBlock
>
<
TextBlock
Text
=
"{Binding Path=Fields.Alias}"
Foreground
=
"{Binding Path=Fields.isGroup,Converter={StaticResource BoolFontConverter}}"
Width
=
"200"
></
TextBlock
>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
my:RadTreeView.ItemTemplate
>
</
my:RadTreeView
>
foreach
(RadTreeViewItem item
in
SelectedNode.ChildrenOfType<RadTreeViewItem>())
{
item.IsSelected =
true
;
}
Notes:
1-This code do not select all the children.
2-SelectedNode is of type RadTreeViewItem.
Thanks in advance