RadOutlookBar: Trigger content popup when a minimized RadOutlookBarItem element is clicked and have it automatically close

1 Answer 43 Views
OutlookBar
Richard
Top achievements
Rank 1
Richard asked on 01 Dec 2022, 11:39 AM

When the RadOutlookBar is in the minimized state, I want to trigger the content popup when a RadOutlookBarItem element is clicked, exactly as if MinimizedContentElement (a RadDropDownButton) had been clicked.

My imperfect solution adds a Click event to the RadOutlookBarItem element (which is not a button and only has MouseUp/MouseDown) with an attached property, and when this event is raised MinimizedContentElement.IsOpen is set to true which triggers the popup. (The RadOutlookBar.SelectionChanged event is not used because it is not raised if the item is already selected.)

The issue I have is that the popup stays open when there is a mouse click elsewhere in the window, even with MinimizedContentElement.KeepOpen=false and CloseOnPopupMouseLeftButtonUp=true. When the popup is triggered with a click on MinimizedContentElement, it closes automatically which is the behaviour I desire.

What's the simplest way to achieve this?

 

Thanks for any assistance you can provide.

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 06 Dec 2022, 11:04 AM

Hello Richard,

Based on your description, I set up a small sample project in an attempt to replicate your setup and requirement.

By adding a class handler for the MouseLeftButtonUp event of the RadOutlookBarItem class and opening the RadDropDownButton in it, the popup is correctly closed when clicking away from the RadOutlookBar.

        public static void OnMouseLeftButtonUp (object sender, MouseButtonEventArgs e)
        {
            var outlookBarItem = (RadOutlookBarItem)sender;
            var outlookBar = outlookBarItem.ParentOfType<RadOutlookBar>();
            var btn = outlookBar.ChildrenOfType<RadDropDownButton>().First(x => x.Name == "MinimizedContentElement");
            btn.IsOpen = true;
        }

Can you please have a look at the attached project and let me know if it provides the expected result? If that is not the case, please modify the project to better resemble your scenario and I will gladly assist you further.

Regards,
Dilyan Traykov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
OutlookBar
Asked by
Richard
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or