Search code examples
wpftelerikraddocking

RadPane closes when I change filter operator in FilteringMode="FilterRow"


I have a RadPane in RadPaneGroup in RadDocking

<telerik:RadPane x:Name="MyPinTab"
                                         Header="PinTab"
                                         IsPinned="False"
                                         CanFloat="False"
                                         CanUserClose="False"
                                         IsTabStop="False">
                                <views:MyPinTabView
                                        Tag="{Binding DataContext.MyPinTabViewModel, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, 
                                                                                                            NotifyOnTargetUpdated=True}"
                                        TargetUpdated="MyPinTab_OnUpdated" />

and in this RadPane I have RadTreeListView with FilteringMode="FilterRow". When I try to change filter operator in UI, RadPane closes, how can I fix this?

So it's obviously some RadPane bug. When RadDocking recives mouse click, it checks if it was in it's pane collection or not - then it tries to close unpinned radpane on lost focus, and it loses focus when filter operators popup is clicked. I tried to capture mouse click on this popup, and do event.Hadled = true , but it's not working because it blocks filter operator change as well. I think maybe there is an event which RadDocking invokes when it closes radpane and there I can cancel it by getting mouse coordinates and width/hight of my radpane, but I can't find anything like this


Solution

  • In order to fix this problem, you should create a method for the OnPreviewLostKeyboardFocus event in UserControl, which is used as RadPane's view, with following code:

    private void MyRadPaneView_OnPreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
           
            if (e.NewFocus is System.Windows.Controls.ListBoxItem item)
            {
                e.Handled = true;
                item.IsSelected = true;
            }
        }
    

    At least, it worked for me.