How to handle ContextMenuOpening

4 posts, 1 answers
  1. Kasper Schou
    Kasper Schou avatar
    21 posts
    Member since:
    Jul 2009

    Posted 26 May 2011 Link to this post

    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
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 27 May 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kasper Schou
    Kasper Schou avatar
    21 posts
    Member since:
    Jul 2009

    Posted 27 May 2011 Link to this post

    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
  5. Kasper Schou
    Kasper Schou avatar
    21 posts
    Member since:
    Jul 2009

    Posted 27 May 2011 Link to this post

    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
Back to Top