New to Telerik UI for WPFStart a free 30-day trial

Set StaysOpen Property to False of Parent Popup of FilteringControl

Updated on Sep 15, 2025

Environment

Product Version2023.2.606
ProductRadVirtualGrid for WPF

Description

How to set the StaysOpen property of the RadVirtualGrid FilteringControl's parent Popup element.

Solution

To achieve this requirement, utilize the EventManager.RegisterClassHandler method to subscribe to the Loaded event of each FilteringControl instance:

Subscribing to Loaded event of FilteringControl

C#
    public partial class MainWindow : Window
    {
        static MainWindow()
        {
            EventManager.RegisterClassHandler(typeof(FilteringControl), LoadedEvent, new RoutedEventHandler (OnLoaded));
        }
    }

In the added event handler, retrieve the parent Popup element of the FilteringControl instance using the ParentOfType extension method. Then, set its StaysOpen property to False.

Set the StaysOpen property of the parent Popup

C#
public partial class MainWindow : Window
    {
        static MainWindow()
        {
            EventManager.RegisterClassHandler(typeof(FilteringControl), LoadedEvent, new    RoutedEventHandler(OnLoaded));
        }

        private static void OnLoaded(object sender, RoutedEventArgs e)
        {
            FilteringControl filteringControl = (FilteringControl)sender;

            Popup popup = filteringControl.ParentOfType<Popup>();

            if (popup != null)
            {
                popup.StaysOpen = false;
            }
        }
    }
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support