New to Telerik UI for WPF? Download free 30-day trial

Opening on a Specific Event

Setting the EventName property will make RadContextMenu to listen for a particular event. When this event occurs, the RadContextMenu will open. For example, you may want to attach a context menu to a Button and the context menu to open whenever the Button gets clicked. This can be done by just setting the EventName property to the name of the event, in this case "Click".

RadContextMenu can listen for any of the events of the control to which it is attached.

<Button Width="100" 
        Content="Click me!" 
        VerticalAlignment="Top"> 
    <telerik:RadContextMenu.ContextMenu> 
        <telerik:RadContextMenu EventName="Click"> 
            ... 
        </telerik:RadContextMenu> 
    </telerik:RadContextMenu.ContextMenu> 
</Button> 

As you can see in this particular example, RadContextMenu is listening for the Click event of its host. So when you click the button, a context menu will appear.

WPF RadContextMenu Opened on Click Event

See Also

In this article