Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
UltraExpandableGroupBox : collapse issue
posted
Hi,
First, sorry for my English.
I have 2 UltraExpandableGroupBox (gb1 and gb2) created dynamically inside a panel (panel1). gb1 is located above gb2. When gb2 is expanded, the vertical scrollbar appears (which is fine). Then, I want gb2 to be collapsed, but a problem occurs if gb2 does not have the focus. 
In this situation, if I click on the expansion indicator "-" of gb2 :
- the expansion indicator gets focused, 
- gb2 does not collapse ! ,
- Instead, my expanded gb2 takes all the space in my panel (we have to scroll to reach gb1)
- I have to click once again on the expansion indicator to see my gb2 collapsing !
To avoid this problem, I have to scroll vertically until the gb2 header is at the top inside my panel1: my gb2 collapses on my first click only in this case (when not focused)!
What should I do to ensure that my gb2 collapses on the first click without scrolling?
Thanks for your help!
Parents
No Data
Reply
  • 21795
    Verified Answer
    Offline posted

    Hello Catherine,

    Your issue appears in a result of normal event flow in Windows Forms. More specifically what happens when you click on your UltraExpandableGroupBox (gb2) while it is not on top of your panel (panel1) is:

    • On MouseDown event gb2 gets focus and fires ScrollToControl method of its parent container – panel1;

    • ScrollToControl method of panel1 calculates the scroll offset to gb2 and depending on this value adjust the scrolled position of gb2 – effectively puts the gb2 on top of the panel1;

    • On MouseUp event nothing happens. This event is fired with mouse coordinates different from gb2’s expansion indicator position, as gb2 is already scrolled.

    What you can do is to override ScrollToControl method of UltraPanel in your custom class derived from UltraPanel class. In this custom class you can make ScrollToControl method to return the current position of UltraExpandableGroupBox.

    Please check attached demo solution and tell me is this is what you are looking for or if I am missing something.

    CAS-141459-D6T5R9.zip
Children