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

How to handle ContextMenuOpening

3 Answers 278 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Kasper Schou
Top achievements
Rank 1
Kasper Schou asked on 26 May 2011, 09:42 AM
Hi Telerik,

I'm having trouble triggering the ContextMenuOpening event in order to handle the event and not show the context menu.

With standard WPF context menu I would handle the event on the control owning the context menu, but I can't seem to get this right with RadContextMenu control. Hope you can guide me on how to achieve this. I have a code block as below:

<telerik:RadCalendar Grid.Row="1" Margin="6,6,6,6" x:Name="calendar" IsTodayHighlighted="False" telerikControls:StyleManager.Theme="Vista"
            DayTemplateSelector="{StaticResource templateSelector}" Columns="4" Rows="3" ViewsHeaderVisibility="Visible" FirstDayOfWeek="Monday"
            HeaderVisibility="Visible" ContextMenuOpening="calendar_ContextMenuOpening">
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu x:Name="cmCalendar" Opened="ContextMenuCalendar_Opened" telerikControls:StyleManager.Theme="Vista">
            <telerik:RadMenuItem x:Name="miHoliday" Header="{x:Static local:CentralCalendarWindowGlossary.miHoliday_Header}" Click="MenuItemHoliday_Click" IsCheckable="True" ToolTipService.ShowOnDisabled="True" ToolTipService.IsEnabled="{Binding Path=IsEnabled}" ToolTip="{DynamicResource toolTipDefault}" />
            <telerik:RadMenuItem x:Name="miNoDistribution" Header="{x:Static local:CentralCalendarWindowGlossary.miNoDistribution_Header}" IsCheckable="True" Click="MenuItemNoDistribution_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.IsEnabled="{Binding Path=IsEnabled}" ToolTip="{DynamicResource toolTipDefault}" />
            <telerik:RadMenuItem IsSeparator="True" />
            <telerik:RadMenuItem x:Name="miSiteDistribution" Header="{x:Static local:CentralCalendarWindowGlossary.miSiteDistribution_Header}" Click="MenuItemSiteDistribution_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.IsEnabled="{Binding Path=IsEnabled}" ToolTip="{DynamicResource toolTipDefault}">
                <telerik:RadMenuItem.Icon>
                    <Image Source="/AN.Planner.Administrator;component/Images/SiteDetailsViewSmall.ico" />
                </telerik:RadMenuItem.Icon>
            </telerik:RadMenuItem>
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
</telerik:RadCalendar>

The event never invokes "calendar_ContextMenuOpening"

Thanks in advance,
Best regards
Kasper Schou

3 Answers, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 27 May 2011, 10:16 AM
Hi Kasper,

Unfortunately, I was unable to reproduce the bug. I have made a short video in which you can see my attempt. Please feel free to correct me if I am doing something wrong.
Please try to reproduce it in a sample application and send it back to us in order to track down the source of the problem.

Looking forward to your reply.

Regards,
Konstantina
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
Kasper Schou
Top achievements
Rank 1
answered on 27 May 2011, 12:25 PM
Hi Konstantina,

Thank you for the swift reply and the video example.

It seems you are doing the same I do, so I guess I will try copy this code into a new sample at test it. Something else must be blocking my event..

I'll get back when I've done this test.

Thanks,
/Kasper Schou
0
Kasper Schou
Top achievements
Rank 1
answered on 27 May 2011, 02:33 PM
Hi,

I now found my problem and it was nothing with the code, but I apperently was not working on the latest build of your controls. I performed the Upgrade Wizard, and after that it worked fine.

Thank you and im sorry for the inconvenience due to this mistake..

Best regards,
Kasper Schou
Tags
ContextMenu
Asked by
Kasper Schou
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Kasper Schou
Top achievements
Rank 1
Share this question
or