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

Events

This article lists the events of the RadCallout control when placed inside a Popup. Subscribing to the events of the control can be achieved through the CalloutPopupService class. The service exposes several methods to add/remove event handlers for the RadCallout control events.

The following events are related only for the placement target element.

Subscribe to RadCallout Events in XAML

You can subscribe to the placement target element events of the Popup holding the RadCallout, using the CalloutPopupService.

Example 1: Add event handler to PopupOpening in XAML

        <telerik:RadButton x:Name="myPlacementTargetElement" telerik:CalloutPopupService.PopupOpening="OnPopupOpening" Content="My Button"  /> 

Subscribe to RadCallout Events in Code Behind

  • PopupOpening: Occurs before the RadCallout is shown. Through the CancelRoutedEventArgs, you can access the following property:

    • Cancel: A boolean property that can be used to cancel the control from appearing.

    Example 2: Add event handler to PopupOpening

            public MainWindow() 
            { 
                InitializeComponent(); 
                CalloutPopupService.AddPopupOpeningHandler(myPlacementTargetElement, OnPopupOpening); 
            }                        
            private void OnPopupOpening(object sender, CancelRoutedEventArgs e) 
            {                        
            } 
    
  • PopupOpened: Occurs after the RadCallout is shown.

    Example 3: Add event handler to PopupOpened

            public MainWindow() 
            { 
                InitializeComponent(); 
                CalloutPopupService.AddPopupOpenedHandler(myPlacementTargetElement, OnPopupOpened); 
            } 
            private void OnPopupOpened(object sender, RoutedEventArgs e) 
            {                        
            } 
    
  • PopupClosing: Occurs before the RadCallout is closed. Through the CancelRoutedEventArgs, you can access the following property:

    • Cancel: A boolean property that can be used to cancel the RadCallout control from closing.

    Example 4: Add event handler to PopupClosing

            public MainWindow() 
            { 
                InitializeComponent(); 
                CalloutPopupService.AddPopupClosingHandler(myPlacementTargetElement, OnPopupClosing); 
            } 
            private void OnPopupClosing(object sender, CancelRoutedEventArgs e) 
            {                        
            } 
    
  • PopupClosed: Occurs after the RadCallout is closed.

    Example 5: Add event handler to PopupClosed

            public MainWindow() 
            { 
                InitializeComponent(); 
                CalloutPopupService.AddPopupClosedHandler(myPlacementTargetElement, OnPopupClosed); 
            } 
            private void OnPopupClosed(object sender, RoutedEventArgs e) 
            {                        
            } 
    

    Unsubscribe from RadCallout Events

The CalloutPopupService class expose several methods to remove the events handlers.

Example 6: Remove event handlers

    public MainWindow() 
    { 
        InitializeComponent(); 
        CalloutPopupService.RemovePopupOpeningHandler(myPlacementTargetElement, OnPopupOpening); 
        CalloutPopupService.RemovePopupOpenedHandler(myPlacementTargetElement, OnPopupOpened); 
        CalloutPopupService.RemovePopupClosingHandler(myPlacementTargetElement, OnPopupClosing);                 
        CalloutPopupService.RemovePopupClosedHandler(myPlacementTargetElement, OnPopupClosed); 
    }            

See Also

In this article