5 Answers, 1 is accepted
0
Hello Jon,
You can define a different DataTemplate for each level of the tree - thus declaring different templates for the separate types of data items. Then you can define a ContextMenu only in the Products and Categories DataTemplates. For example the Products DataTemplate can be defines as:
Give this approach a try and let me know if it works for you.
However, if your scenario requires a different approach or you need more info, please let us know.
Sincerely yours,
Tina Stancheva
the Telerik team
You can define a different DataTemplate for each level of the tree - thus declaring different templates for the separate types of data items. Then you can define a ContextMenu only in the Products and Categories DataTemplates. For example the Products DataTemplate can be defines as:
<
telerik:HierarchicalDataTemplate
x:Key
=
"ProductsTemplate"
>
<
TextBlock
Text
=
"{Binding Name}"
>
<
telerikNavigation:RadContextMenu.ContextMenu
>
<
telerikNavigation:RadContextMenu
Opened
=
"RadContextMenu_Opened"
>
<
telerikNavigation:RadMenuItem
Header
=
"Item1"
/>
<
telerikNavigation:RadMenuItem
Header
=
"Item2"
/>
</
telerikNavigation:RadContextMenu
>
</
telerikNavigation:RadContextMenu.ContextMenu
>
</
TextBlock
>
</
telerik:HierarchicalDataTemplate
>
However, if your scenario requires a different approach or you need more info, please let us know.
Sincerely yours,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jon
Top achievements
Rank 1
answered on 01 Jul 2010, 03:58 PM
Hi..
The treeview is programmatically generated.
How can I determine the branch? I only want the context menu on branch 3 and 4
thanks again
The treeview is programmatically generated.
How can I determine the branch? I only want the context menu on branch 3 and 4
thanks again
0

Jon
Top achievements
Rank 1
answered on 02 Jul 2010, 02:07 PM
Any ideas?
thanks again
thanks again
0
Accepted
Hi Jon,
Since you generate the RadTreeViewItems in the code-behind, you can check if you are about to create "branch 3 or 4" item just attach a ContextMenu to it.
If you have further questions, please ask us.
Sincerely yours,
Miro Miroslavov
the Telerik team
Since you generate the RadTreeViewItems in the code-behind, you can check if you are about to create "branch 3 or 4" item just attach a ContextMenu to it.
RadTreeViewItem newItem = new RadTreeViewItem();
//initialize it here.
//Check if the newItem should have ContextMenu?
//Then
RadContextMenu menu = new RadContextMenu();
//add MenuItems here
RadContextMenu.SetContextMenu(newItem , menu);
If you have further questions, please ask us.
Sincerely yours,
Miro Miroslavov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jon
Top achievements
Rank 1
answered on 03 Jul 2010, 03:09 PM
Thanks again