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

Why cann't RadContextMenu bind to a data context command ??

5 Answers 67 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carlos
Top achievements
Rank 1
Carlos asked on 08 Aug 2013, 11:41 PM
I spent 2+hrs trying to get some simple binding with the RadContextMenu.

Trying to Bind a command and a title. It never works.

Problem like this with your rad controls are making me waste hours!  

Why can it bind to a data context command ?? 

<Image Source="/Images/appbar.list.png">
    <telerikPrimitives:RadContextMenu.ContextMenu>
        <telerikPrimitives:RadContextMenu IsOpen="{Binding IsChecked, ElementName=ctrlBtnOpenPopup, Mode=TwoWay}">
            <telerikPrimitives:RadContextMenuItem  Content="{Binding Title}" Command="{Binding PodPageViewModel.CmdMarkEpisodeShare, Mode=OneWay}">
            </telerikPrimitives:RadContextMenuItem>
        </telerikPrimitives:RadContextMenu>
    </telerikPrimitives:RadContextMenu.ContextMenu>
</Image>

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 13 Aug 2013, 08:54 AM
Hi Carlos,

Thanks for writing.

Based on the XAML snippet you are sharing we cannot exactly say what happens. Most probably the DataContext you are binding against is not correct. Can you please make sure the data context that is assigned to the context menu is the one which is expected?

It will also be useful if you can send us a sample which reproduces the issue or your entire project for further investigation. You will have to open a new support ticket in order to be able to do that.

Thanks for your time.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Carlos
Top achievements
Rank 1
answered on 14 Aug 2013, 12:22 PM

The DataContext is correct.  I missed to tell you that the menu is within a datatemplate.

to recreate:

- Create a DataTemplate with context menu elements (somethin like my xaml)
- Set as content template in a ContenControl  
- Set proper context in the content control (with the command to bind to)

No binding occurs...

What's the problem ? 

thanks
0
Deyan
Telerik team
answered on 19 Aug 2013, 07:03 AM
Hi Carlos,

The reason for this behavior is that the Context menu is inserted at root level in your page. The data context that you are setting is therefore not accessible by the items.

Try directly setting the DataContext property of the ContextMenu instead.

I hope this helps.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Carlos
Top achievements
Rank 1
answered on 20 Aug 2013, 10:20 AM
thanks for your feedback. I will re-visit this code soon and try your suggestion
0
Deyan
Telerik team
answered on 23 Aug 2013, 07:37 AM
Hi Carlos,

We will consider your thread closed for now.

Feel free to reopen it in case of further questions.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
ContextMenu
Asked by
Carlos
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Carlos
Top achievements
Rank 1
Share this question
or