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

Filtering Popup Remains Opened

PROBLEM

When the the filter popup on a column is opened and the user switches to another desktop app with the keyboard (for example, pressing Alt+Tab), not the mouse, then the RadGridView filter popup remains open.

CAUSE

The reason for this behavior is that the filtering popup is listening for the mouse click event and it will be closed when the user clicks outside of the popup.

SOLUTION 1 (Before Q1 2016)

You will need to subscribe for the Deactivated event of the MainWindow and ensure the filtering popup is closed.

For example, you can close the popup with the following code:

Example 1: Closing the Filtering Popup from the Deactivated event

var FilterDialogs = this.radGridView.ChildrenOfType<Popup>().Where(p => p.Name == "PART_DropDownPopup"); 
if (FilterDialogs != null) 
{ 
    foreach (Popup FilterDialog in FilterDialogs) 
    { 
        if (FilterDialog.IsOpen) 
            FilterDialog.IsOpen = false; 
    } 
} 
Dim FilterDialogs = Me.radGridView.ChildrenOfType(Of Popup)().Where(Function(p) p.Name = "PART_DropDownPopup") 
If FilterDialogs IsNot Nothing Then 
    For Each FilterDialog As Popup In FilterDialogs 
        If FilterDialog.IsOpen Then 
            FilterDialog.IsOpen = False 
        End If 
    Next 
End If 

SOLUTION 2 (After Q1 2016)

As of Q1 2016, we have introduced the ShouldCloseFilteringPopupOnKeyboardFocusChanged property, which controls whether the filtering popup should close on keyboard focus change. Setting it to True will close the popup when a user switches to another application, no matter if they do that by using Alt+Tab or by clicking away with the mouse.

And here is how to set it:

Example 2: Closing the Filtering Popup in XAML

<telerik:RadGridView ShouldCloseFilteringPopupOnKeyboardFocusChanged="True" /> 

See Also

In this article