RadRibbonDropDownButton DropDown issues (dropdown closes unexpectedly, keepopen behavior side effect, attached property request)

5 posts, 0 answers
  1. William
    William avatar
    15 posts
    Member since:
    Jun 2010

    Posted 22 Mar 2011 Link to this post

    Hi,
    I have a button with a ListBox control as part of its dropdown content. The content also contains 'ok' and 'cancel' buttons to allow the user to dismiss the dropdown when they are done. I have run into a number of problems trying to get this to work. I don't know whether they are bugs or whether I should be doing this another way so I look forward to any comments that you may post.

    Here they are:

    1. When a listbox item is selected then the dropdown content closes. This happens because RadGallery.cs registers a handler that unconditionally closes the dropdown when a listbox selection changes. This seems like the right thing to do since there needs to be a way for the dropdown to close but inhis case it is undesirable since I have buttons that serve that function. What I am wondering is if an attached property could be created that could give the handler some direction about whether it should close the dropdown. I would then be able to attach this property to my listbox and the handler would know that it shouldn't close the dropdown.

    2. I got around the 'listbox selection closing' problem by setting RadRibbonDropDownButton.KeepOpen = true but this brings on the next issue. 'KeepOpen' appears to work not by preventing the dropdown content from closing but by reopening after its been closed. This isn't obvious when interacting with the control but if you look at the call stack then you'll see that there is a call to 'IsOpen = false' that is quickly followed by a call to 'IsOpen = true'. The side effect of this is that every time a listbox item is selected then the 'DropDownOpening' event is raised. This is undesirable because I have some state variables that I would like to set only when the dropdown content is first displayed. My expectation was that this event would get called only when the drop down was opening and not additionally whenever a listbox item was selected.

    3. This one is really more of a question followed by what may be a request. In order for my 'ok' and 'cancel' buttons to close the dropdown programmatically they must determine the RadRibbonDropDownButton control that the dropdown belongs to but I could find no straightforward way to do this other than giving the button a name and then referring to that name in the handlers. What I'd really like to do is to get this to work in a more generic way since my desire is to move the 'ok' and 'cancel' button handlers into a class which I would then use as a base class for other dropdown content. So the question is whether there is a way to do this that I am missing. If there is none then I have a request, which is for the RadRibbonDropDownButton to attach a property to the topmost visual of its dropdown (a popup I suppose) that indicates the RadRibbonDropDownButton that owns the dropdown.
    Thanks and best regards,
    Pete
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 25 Mar 2011 Link to this post

    Hi William,

    Please examine the attached solution where a possible approach for your issue is demonstrated. By the default the when SelectionChanged is fired in the dropdown content , the dropdown button closes which is expected ( you may see this behavior in the dropdown buttons  in ms office). Setting KeepOpen to true removes this behavior but does not allow you to work with the IsOpenProperty. So you need to set KeepOpen to false on the go in order to use IsOpen for close/open operations. On the other hand I could reproduce the problem with the Opening event firing multiple times when selecting an item in the listbox. Please let me know if I have missed something.
    Additionally, getting a parent element of a particular type can be achieved with the extension method ParentofType<> . You can also inspect this in the attached solution.
    Let us know if you need more info and excuse us for the late response.

    Best wishes,
    Petar Mladenov
    the Telerik team
  3. UI for WPF is Visual Studio 2017 Ready
  4. William
    William avatar
    15 posts
    Member since:
    Jun 2010

    Posted 27 Mar 2011 Link to this post

    Hi Petar,
    Thank you very much for the response.
     
    The extension method ParentofType<> was exactly what I was looking for. Thanks.

    I am glad that you were able to reproduce the problem with the Opening event firing multiple times. Are there any plans to change this behavior?

    Keep up the good work,
    Pete
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Mar 2011 Link to this post

    Hello William,

    Actually, I wanted to say that i did NOT manage to reproduce the multiple-selection-chaged-firing issue. Please excuse me for misleading you. That`s why I wanted you to correct me if I am missing something in the attached project. You can modify the solution in my previos post so that the problem is reproducible. This way we could investigate it in depth and advice you better. Thank for your cooperation in advance.

    Regards,
    Petar Mladenov
    the Telerik team
  6. Mohd
    Mohd avatar
    19 posts
    Member since:
    Aug 2011

    Posted 17 Oct 2012 Link to this post

    Hi I have downloaded your sample and now i am stuck in some other kind of issue.
    When i set property KeepOpen="True" of RadRibbonDropDownButton then its content is on top of all other applications
    Ideally focussed window should be at top.
    See the attached Image.
    Plz Help me out Its Urgent
Back to Top
UI for WPF is Visual Studio 2017 Ready