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

Collapse RadRibbonBarGroup not working

3 Answers 205 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 29 Nov 2010, 06:32 PM
I am using WinForms Q2 2010 SP2 RadRibbonBar control.  According to http://www.telerik.com/help/winforms/ribbonbar-end-user-capabilities-collapsing-the-ribbonbar.html, the right-most RadRibbonBarGroup will collapse to a simple rectangle when the form containing the RadRibbonBar is resized smaller than the RadRibbonBarGroup size.  This isn't working for me.  When I resize the form to a smaller size, ALL of the RadRibbonBarGroups collapse AND none of them collapse to a simple rectangle.  How do I manage this programatically?

3 Answers, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 30 Nov 2010, 02:03 PM

Just to expand a bit. The section of the project I am working on is allowing the user to create an ad-hoc query where each RadRibbonBarGroup hosts a user control to help the user select a specific element of the query.  What I actually need to do, after I can get control over ALL of the RadRibbonBarGroups collapsing when the form is smaller than their total widths combined, is to gain programatic control over collapsing and expanding any selected RadRibbonBarGroup.

The RadRibbonBarGroup.Visibility property doesn't do this for me.

// shows the hosted control in it's occupied space.
radRibbonBarGroup3.Visibility = ElementVisibility.Visible 
  
// hides the hosted control and leaves the would-be occupied space empty.
radRibbonBarGroup3.Visibility = ElementVisibility.Hidden 
  
// hides the element completely, as it should.
radRibbonBarGroup3.Visibility = ElementVisibility.Collapsed

1. But which property do I set to collapse the RadRibbonBarGroup to a simple rectangle that contains the down-arrow icon (that dispays the hosted control when clicked)?
2. What property do I set to change the image from a down-arrow icon to one of my choosing?

0
Accepted
Peter
Telerik team
answered on 02 Dec 2010, 03:15 PM
Hi Gary,

Thank you for the writing.

The collapse operation in RibbonBar is performed in the public class ExpandableStackLayout and each item in this StackLayout that inherits from the public abstract class CollapsibleElement can be expanded or collapsed. By default, ExpandableStackLayout checks if the sum of all sizes of the elements are larger than the available space and calls CollapseToStep method for these elements with CollapseStep smaller than CollapseMaxSteps.

The values of CollapseToStep are:

public enum ChunkVisibilityState : int
{
Expanded = 1,
SmallImages = 3,
NoText = 2,
Collapsed = 4
}

You can easily collapse any collapsible element with CollapseElementToStep method and expand with ExpandElementToStep method.

For more details please refer to the attached project.

I hope this helps.

Kind regards,
Peter
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Gary
Top achievements
Rank 1
answered on 02 Dec 2010, 10:21 PM
That worked.  Thank you very much.

Your product is great!
Tags
RibbonBar
Asked by
Gary
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Peter
Telerik team
Share this question
or