New to Telerik UI for WPF? Start a free 30-day trial
Set StaysOpen Property to False of Parent Popup of FilteringControl
Updated on Sep 15, 2025
Environment
| Product Version | 2023.2.606 |
| Product | RadVirtualGrid 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;
}
}
}