This is a migrated thread and some comments may be shown as answers.

RadContextMenu in RadTreeListView

3 Answers 160 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Adriano
Top achievements
Rank 1
Adriano asked on 20 May 2010, 03:40 PM
Hi, is it possible to attach a RadContextMenu on a RadTreeListView? Because we tried to follow the instructions of the RadTreeView sample but with no success.

Best regards
Adriano

3 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 25 May 2010, 11:54 AM
Hi Adriano,

What example are you following?

If the context menu there is part of the ItemTemplate of the TreeView it will indeed not work for the TreeList because the ItemTemplate in the TreeList appears as a details view for the items.

You can assign one context menu for the whole TreeList and find the item that has been clicked in the Opened event:

private void OnMenuOpened(object sender, RoutedEventArgs e)
{
    var row = contextMenu.GetClickedElement<RadTreeListViewItem>();
    if (row != null)
    {
        var dataItem = row.Item;
    }
}

And the xaml:

<telerikNavigation:RadContextMenu.ContextMenu>
    <telerikNavigation:RadContextMenu x:Name="contextMenu" Opened="OnMenuOpened">
        <telerikNavigation:RadMenuItem Header="Action 1" />
        <telerikNavigation:RadMenuItem Header="Action 2"/>
    </telerikNavigation:RadContextMenu>
</telerikNavigation:RadContextMenu.ContextMenu>

Hopefully this will help you,

Best wishes,
Miroslav
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
Gili
Top achievements
Rank 1
answered on 21 May 2013, 06:09 AM

Hi, is it possible to attach a RadContextMenu on a RadTreeListView? 
Because we tried to follow the instructions of the RadTreeView sample but with no success.



I tried the solution and got an error  RadTreeListViewItem  does not exist  .
i can see it is an old (thread) question 
but i have the same question now. 
so how can i do it ? 
thank you



 
0
Yoan
Telerik team
answered on 21 May 2013, 02:32 PM
Hello Gili,

Please find attached a sample project which meets your
requirements.

If you need further assistance on this, do not hesitate to contact us again!

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeListView
Asked by
Adriano
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Gili
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or