RadDropDownButton: Open on MouseDown

6 posts, 0 answers
  1. Alexander
    Alexander avatar
    77 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2014 Link to this post

    Hello,

    Is there a way to open the DropDownContent of the RadDropDownButton not on MouseUp, but already on MouseDown?
    I could create an PreviewMouseDown event handler and toggle the IsOpen property. However, the button for some reason also captures the mouse so that I always get an inconsistent behavior on the second click. But when I say e.IsHandled = true, I cannot click any controls inside the popup...

    The Idea is that the button should behave similar to a menu:
    - The first click on button opens the popup, the second click anywhere outside of the popup closes it.
    - A click inside of the popup is ignored by the button (I have different controls inside the popup, not only buttons).

    Alex
  2. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 12 Sep 2014 Link to this post

    Hello Alexander,

    The RadDropDownButton has a ClickMode property which is controls when the DropDownContent is opened. Setting the ClickMode property to "Press" will force the button to open on MouseLeftButtonDown.

    I hope this information helps. Please let us know if you need further assistance.

    Kind regards,
    Kiril Vandov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alexander
    Alexander avatar
    77 posts
    Member since:
    Apr 2013

    Posted 12 Sep 2014 in reply to Kiril Vandov Link to this post

    Thanks for your answer.
    However, it is still not the expected result:

    - When I click the button the first time, the DropDownContents shows up, clicking it the second time closes it. This is good.
    - However, clicking ouside of the popup does not close it any more, but clicking inside the popup closes it. This is not good...

    The KeepOpen property does not seem to have any effect.

    Alex
  5. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 17 Sep 2014 Link to this post

    Hello Alexander,

    I was not able to reproduce the described behavior on our side, I have attached the sample project used in my test. Could you please take a look at it and modify it in order to reproduce the issue on our side. A control inside the DropDownContent may be the cause of the issue.

    Looking forward to hearing from you.

    Kind regards,
    Kiril Vandov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Alexander
    Alexander avatar
    77 posts
    Member since:
    Apr 2013

    Posted 17 Sep 2014 in reply to Kiril Vandov Link to this post

    Thanks for your efforts.
    I now found the reason: I use my own Style, but the Popup had a wrong name (it was named "PART_Popup" instead of "DropDownPopup"). Therefore, the IsOpen Property of the Poup was not updated automatically (and I did not expect it to happen). Instead instead I created a Binding

    IsOpen="{Binding Path=IsOpen, RelativeSource={RelativeSource TemplatedParent}}"

    Which opens and closes the popup, but had the mentioned side effects. (Indeed, I have another control which is not a button itself but contains the button in its ControlTemplate - and it works this way, so I did not suspect anything to be wrong with the binding).

    Alex
  7. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 18 Sep 2014 Link to this post

    Hello Alexander,

    I am glad to hear that you have found a solution for the problem. Please let us know if you need further assistance.

    Kind regards,
    Kiril Vandov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready