This is a migrated thread and some comments may be shown as answers.

Controlling portions of the Radsplitbutton

2 Answers 72 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 01 Nov 2011, 08:37 PM
Hi,
I've recently started using Rad controls for WPF in Powerbuilder .NET 12.5

I'm using powerscript to control most of the basic events within my Radbuttons (such as open / close windows, set text labels, etc.)

The issue I'm having is getting full control of the Radsplitbutton.

For example, I currently have a radsplitbutton1 where isOpen = true when the MouseEnter event occurs.  I can also use AutoOpenDelay to achieve the same result.

However, I cannot find any way to close the popup.  I've tried putting isOpen = false into the MouseLeave and LostFocus events, but it never closes.  And there doesn't seem to be anything similar to AutoOpenDelay which will close the popup instead of open it.

Also, the AutoOpenDelay seems to cover the entire button.  I'm not sure if there is a way to open the popup ONLY when the mouse is on the drop down arrow?

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 04 Nov 2011, 03:27 PM
Hi Brad,

We agree that this does not work correctly. The System.Windows.Controls.Primitives.Popup that is used for the DropDownContent of the RadDropDownButton and the RadSplitButton has its StaysOpen property to false which does not respect the close operation performed in MouseLeave event handler of the Button.
However, there is a workaround which is elegant but it works;

private void button_MouseLeave_1(object sender, MouseEventArgs e)
       {
           this.button.IsOpen = false;
       }
 
       private void button_DropDownOpened(object sender, RoutedEventArgs e)
       {
           var dropdownContent = (sender as RadSplitButton).DropDownContent;
           if (dropdownContent != null && dropdownContent is UIElement)
           {
               var popup = (dropdownContent as UIElement).ParentOfType<Popup>();
               if (popup != null)
               {
                   popup.StaysOpen = true;
               }
           }
       }
You can find this realized in the attached solution.  All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Petar Mladenov
Telerik team
answered on 04 Nov 2011, 03:29 PM
Hi Brad,

You can find a good explanation of how StaysOpen works here.

Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Buttons
Asked by
Brad
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or