I am using the HierarchicalDataTemplate in my RadTreeView. The content of the data template is a grid and the grid has a context menu specified. The problem is the grid does not fill the RadTreeView cell (it seems to size to the content) so the context menu only displays if you click on the content, not anywhere in the cell. Is there a way to force the template to fill the cell or is there a better way to implement data template specific context menus?
An example of one of my data templates is:
My RadTreeView instance is:
An example of one of my data templates is:
<
HierarchicalDataTemplate
DataType
=
"{x:Type DTMLib:DTMHostsNode}"
ItemsSource
=
"{Binding Hosts}"
>
<
Grid
Background
=
"Red"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Image
Grid.Column
=
"0"
Width
=
"20"
Height
=
"20"
Source
=
"Images/Remote.png"
/>
<
TextBlock
Grid.Column
=
"1"
Text
=
"{Binding Name}"
VerticalAlignment
=
"Center"
Margin
=
"5,0,0,0"
/>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
Opening
=
"RootContextMenuOpening"
>
<
telerik:RadMenuItem
x:Name
=
"ApplyCSVFileColumns"
Header
=
"Apply CSV File Columns"
Click
=
"ApplyRootCsvColumnsClick"
/>
<
telerik:RadMenuItem
x:Name
=
"PlaybackCSVFiles"
Header
=
"Playback CSV Files"
Click
=
"PlaybackCsvFilesClick"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
</
Grid
>
</
HierarchicalDataTemplate
>
My RadTreeView instance is:
<
telerik:RadTreeView
x:Name
=
"ManagerTreeView"
Grid.Row
=
"0"
Grid.Column
=
"0"
HorizontalContentAlignment
=
"Stretch"
/>