Controlling portions of the Radsplitbutton

3 posts, 0 answers
  1. Brad
    Brad avatar
    1 posts
    Member since:
    Oct 2011

    Posted 01 Nov 2011 Link to this post

    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. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Nov 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Nov 2011 Link to this post

    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 >>

Back to Top