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

RadMenu per RadGridView Row?

2 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 30 Sep 2011, 08:06 AM

Hi all,

(I have cross-posted this to the two relevant forums)

Is it possible to have a RadMenu per RadGridView row? I have a Windows explorer-style interface with a tree view on the left and a RadGridView on the right providing a listview style view. The commands for each of my items can vary. In the tree they are data bound to a RadMenu at runtime. Is there a way of doing this per row in a RadGridView?

The only sample I have found shows a menu for the entire grid, not per row.

I have tried per column by putting a menu inside the CellTemplate alongside the other controls but get a memeory vialoation error!

Any tips or tricks would be appreciated.

Cheers,
Chris.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 30 Sep 2011, 08:10 AM
Hello Chris,

 You can use single menu for the whole grid however provide different items using Opened event. In this demo items are static however you can do the same with dynamic items. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Chris
Top achievements
Rank 1
answered on 30 Sep 2011, 08:18 AM
Hi

Thanks for the reply, it is a possible solution.

However, I have just realised I was missing a converter and that is why my xaml was invalid. The code below now seems to work for me. I suppose this means I would need to do it for eaxch column though so not ideal.

Thanks,
Chris.
<telerik:GridViewDataColumn Header="Name">           
    <telerik:GridViewDataColumn.CellTemplate>               
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="ContextMenu" StaysOpen="False"
                            ItemsSource="{Binding NavigationCommands}" ItemTemplate="{StaticResource ContextMenuItemTemplate}">
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>
                <Image Source="{Binding Category, StringFormat='../Resources/Images/Icons/\{0\}_16.png'}" Width="16" Height="16" Margin="0,0,5,0"/>
                <TextBlock Text="{Binding Name}" />
            </StackPanel>          
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>

Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Chris
Top achievements
Rank 1
Share this question
or