I am working on some legacy code, I have RadTreeView with Item template which expand the hierarchy at doubleclick, I want to add a contextmenu which expand the hierarchy in the same way, problem is that there is no command to bind to expand nodes. How can I have the context menu work in the same way as the itemtemplate?
<
p
></
p
><
p
> <
telerik:RadTreeView
Grid.Row
=
"2"
Background
=
"White"
BorderBrush
=
"DarkGray"
BorderThickness
=
"1"
VerticalAlignment
=
"Stretch"
<br>
Name="ResultSetReportTreeView"<
br
>
IsVirtualizing="True" <
br
>
ItemDoubleClick="RadTreeViewItemDoubleClick"<
br
>
Width="{Binding ElementName=GuideControl, Path=ActualWidth}"<
br
> ItemContainerStyle="{StaticResource ResourceKey=HierarchyTreeViewStyle}"<
br
> SelectedItem="{Binding Path=SelectedNode, Mode=TwoWay}"<
br
>
ItemsSource="{Binding ResultSetReportNodes}"<
br
>
SelectionMode="Single" ><
br
>
<
br
> <
telerik:RadTreeView.Resources
><
br
>
<
Style
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
><
br
>
<
Setter
Property
=
"IsExpanded"
Value
=
"{Binding Path=IsExpanded, Mode=TwoWay}"
/><
br
>
</
Style
><
br
>
</
telerik:RadTreeView.Resources
><
br
>
<
telerik:RadTreeView.ItemTemplate
><
br
>
<
HierarchicalDataTemplate
ItemsSource
=
"{Binding Path=Children}"
><
br
>
<
StackPanel
Orientation
=
"Horizontal"
Background
=
"Transparent"
ToolTip
=
"{Binding Path=Name, Mode=OneWay}"
><
br
>
<
Image
Style
=
"{StaticResource ResourceKey=IconStyle}"
VerticalAlignment
=
"Center"
Margin
=
"5,0,0,0"
/><
br
>
<
TextBlock
Text
=
"{Binding Path=Name}"
ToolTip
=
"{Binding Path=Name, Mode=OneWay}"
Margin
=
"5,0,0,0"
/><
br
>
<!--start of my Context menu-->
<
br
>
<
StackPanel.ContextMenu
><
br
>
<
ContextMenu
><
br
>
<!--ExpandAllDescendantFoldersCommand IsCheckable=" empty I need it to work as itemtemplate does at doubleclick"-->
<
br
> <
MenuItem
Header
=
"{localization:Resx ResxName=Palantir.CommonResources.ButtonLabels, Key=Expand}"
Command
=
"{Binding Path=PlacementTarget.Tag.ExpandAllDescendantFoldersCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}, Mode=OneWay}"
><
br
>
</
MenuItem
><
br
>
</
ContextMenu
><
br
>
</
StackPanel.ContextMenu
><
br
>
</
StackPanel
><
br
>
<!--End of my Context menu-->
<
br
>
</
HierarchicalDataTemplate
><
br
>
</
telerik:RadTreeView.ItemTemplate
><
br
>
</
telerik:RadTreeView
><
br
>
</
Grid
><
br
>
</
telerik:RadExpander
><
br
></
p
>