Issue with context menu inside MultiColumnComboBox

1 Answer 24 Views
MultiColumnComboBox
Matthew
Top achievements
Rank 1
Matthew asked on 30 Nov 2021, 11:17 PM

Hi there,

I'm running into an issue with the RadMultiColumnComboBox where after opening up a context menu, the dropdown loses the ability to dismiss itself when you click away from the grid, despite KeepDropDownOpen still being false.

The easiest way to repro is by using the RadContextMenu and RadGridView MVVM SDK example, except with this modification to the grid at the bottom of Example.xaml:

<Grid>
    <telerik:RadMultiColumnComboBox KeepDropDownOpen="False">
        <telerik:RadMultiColumnComboBox.ItemsSourceProvider>
            <telerik:GridViewItemsSourceProvider ItemsSource="{Binding Items}"/>
        </telerik:RadMultiColumnComboBox.ItemsSourceProvider>
    </telerik:RadMultiColumnComboBox>
</Grid>

After opening the context menu inside the grid's header, the popup can't be closed by clicking in the main window and must be closed by clicking the dropdown button.

I've seen some very old threads regarding similar use cases and those coming back as unsupported but this felt like a natural enough extension of the example case that I wanted to see if this was a bug or not. If it's unsupported, are there any ideas for a workaround?

Thanks,

Matthew

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 03 Dec 2021, 03:44 PM

Hello Matthew,

I was able to reproduce the mentioned behavior on my end as well. I have logged a new bug report into our feedback portal, so, you could vote for it, as well as follow it, to get notified via e-mail when its status gets changed.

In the meantime, you could work this around by manually closing the drop-down menu popup. For example, you could subscribe to the MouseLeftButtonDown event of the Window element. In the event, get the Popup element via the ChildrenOfType extension method, and set the IsOpen property of the returned element, to False.

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    var popup = this.comboBox.ChildrenOfType<Popup>().FirstOrDefault();

    if (popup != null)
    {
        popup.IsOpen = false;
    }
}

I have prepared a sample project that has this approach implemented, so, could you give it a try and let me know how it goes?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Matthew
Top achievements
Rank 1
commented on 07 Dec 2021, 08:08 PM

Hi Stenly,

Sorry for the delay, and thank you for looking at this! I'm not sure how well this specific workaround will work, since the actual application I'm working with has a much more complex UI structure (sometimes this dropdown is in its own modal dialog) and putting the event handling in the root window seems impractical, so I think I'd rather wait and see if the bug gets fixed. But I will definitely keep this workaround in mind!

Thanks,

Matthew

Petar Mladenov
Telerik team
commented on 13 Dec 2021, 05:26 PM

Hi Matthew,
Could you please elaborate more on the usage of ContextMenu in the MultiColumnComboBox - do you open it over the grid view rows and do you expect in this case to keep the drop down opened despite the KeepDropDownOpened set to false ?
Petar Mladenov
Telerik team
commented on 23 Dec 2021, 11:58 AM

Hi Matthew,
In the next week's internal build there will be an update in MultiColumnComboBox's code so that using MS ContextMenu will always return the focus to the combo and the auto-closing behavior will be preserved. For the RadComboBox usage, an additional step is required - to set IsFocusScope of the RadGridView to True. This can be achieved with style so you won't need to use code behind.

We would love to hear any feedback regarding this solution. Thank you in advance for your cooperation.

       <telerik:RadMultiColumnComboBox Name="comboBox" VerticalAlignment="Center" KeepDropDownOpen="False" DisplayMemberPath="Name" SelectionMode="Multiple">
                <telerik:RadMultiColumnComboBox.DropDownElementStyle>
                    <Style TargetType="FrameworkElement">
                        <Setter  Property="FocusManager.IsFocusScope" Value="True" />
                    </Style>
                </telerik:RadMultiColumnComboBox.DropDownElementStyle>

Tags
MultiColumnComboBox
Asked by
Matthew
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or