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

Annoying RibbonBar Size Issue

6 Answers 246 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
UIdev
Top achievements
Rank 1
UIdev asked on 02 Jun 2007, 10:53 PM
Hello,

In my WinForms app, I am using a RibbonBar along with a custom resizing function.  Since I use a custom resizing solution, I have noticed a bug/issue with my RibbonBar.  The default RibbonBar height is 141, and I can seem to change that :S.  During runtime, I add a control to the RadRibbonBarChunk.  This control is of a certain size so that is causes the RibbonBar to grow in height.  Since I can't seem to edit the height of the RibbonBar at design time to make everything work, I have to find some way to adjust the location/size of the control below the RibbonBar that's getting affected, or find a way to force the RibbonBar's height to be greater than 141 at design time.

Any help you can give me with this problem would be wonderful!

--UIDev

6 Answers, 1 is accepted

Sort by
0
Ralf Ehlert
Top achievements
Rank 1
answered on 03 Jun 2007, 02:29 PM
If you don't need some spezial form style, you can set the ControlBox property of the Form to false and delete the texx of the Text property of the Form and you have a Form similar to the FormBorderStyle = None but with the standard nonclient area with it's resizing logic.

I hope this helps.
0
UIdev
Top achievements
Rank 1
answered on 04 Jun 2007, 02:07 AM
I already have a borderless ShapedForm... I guess what I need is some code that, upon the resizing of the ShapedForm, adjusts the location and size properties of pnlLarge (a Panel control beneath the RibbonBar) to the new size of the RibbonBar.  The adverse affect of this whole issue is covering the upper 20 or so pixels of content of the panel.  Hopefully someone good with logic can figure out a way to resize the panel according to the RibbonBar! :)  I know this is kind of a weird issue, but I really appreciate all the help you're giving me :).
0
Jack
Telerik team
answered on 04 Jun 2007, 12:58 PM
Hi David,

Yes, we have some sizing problems with RadRibbonBar. We will fix them in our next major version (Q2 2007).

But there is a workaround you can use. You can resize the RibbonBar's size at design time by following these steps:

  1. Open the Element hierarchy editor 
  2. Choose the RootElement
  3. Set the MinSize.Height property to your desired height
  4. Set the MaxSize.Height property to your desired height
 
Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
UIdev
Top achievements
Rank 1
answered on 04 Jun 2007, 10:08 PM
That solution worked perfectly!  Thank you for your quick solution.
0
Himanshu
Top achievements
Rank 1
answered on 04 Jul 2011, 10:08 AM
Hi,

I am using RadRibbonBar and it is bugging me when I am dynamically adding RibbonBarGroups/Buttons into this, after shorten RadRibbonBar's width. It is working fine with default width of RadRibbonBar, but due to business scenario I need to shorten its width.
The Problem I am facing is it hides the group name from ribbon and all RadButtons are occupying entire width of rad control.
I am using Q1 2011 version of telerik winform controls.


The code is written below to populate dynamic button over RibbonBar.

 private RadRibbonBarGroup radCreateMenuItems(IGrouping<string, PlugInHost> hostGroup, bool visiblisity, int Length)
        {
            RadRibbonBarGroup radMenuGroup = new RadRibbonBarGroup();
            radMenuGroup.AutoSize = false;
            radMenuGroup.FitToSizeMode = RadFitToSizeMode.FitToParentContent;
            //radMenuGroup.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
            radMenuGroup.Text = hostGroup.Key;
            radMenuGroup.Name = hostGroup.Key;
            radMenuGroup.AccessibleDescription = hostGroup.Key;
            radMenuGroup.AccessibleName = hostGroup.Key;
            radMenuGroup.Bounds = new System.Drawing.Rectangle(0, 0, 90, 58);
            if (Length == 1)
            {
                RadButtonElement radHeaderButton = new RadButtonElement();
                radHeaderButton = radCreateMenuItem(hostGroup.First());                
                radMenuGroup.Tag = hostGroup.First();
                radHeaderButton.TextImageRelation = TextImageRelation.ImageAboveText;
                radHeaderButton.ImageAlignment = ContentAlignment.TopCenter;
                radHeaderButton.TextAlignment = ContentAlignment.MiddleCenter;
                radHeaderButton.Tag = hostGroup.First();
                radMenuGroup.Margin = new System.Windows.Forms.Padding(0);
                //radMenuGroup.Items.Add(radHeaderButton);
                radHeaderButton.FitToSizeMode = RadFitToSizeMode.FitToParentBounds;
                //radHeaderButton.AutoSize = true;
                //radHeaderButton.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;                
                radMenuGroup.Items.AddRange(new Telerik.WinControls.RadItem[] {radHeaderButton});
            }
            else
            {                
                radMenuGroup.Visibility = ElementVisibility.Visible;
                ribbonTabPlugIns.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuGroup });
                foreach (var item in hostGroup)
                {
                    //radMenuGroup.Size = new System.Drawing.Size(100, 50);
                    RadButtonElement radHeaderButton = new RadButtonElement();
                    radHeaderButton.Text ="       " + item.ToString() + "       ";
                    radHeaderButton.ToolTipText = hostGroup.Key+ ":      " + item.ToString() + "       ";
                    radHeaderButton = radCreateMenuItem(item);
                    radHeaderButton.TextImageRelation = TextImageRelation.ImageAboveText;
                    radHeaderButton.ImageAlignment = ContentAlignment.TopCenter;
                    radHeaderButton.TextAlignment = ContentAlignment.MiddleCenter;
                    radHeaderButton.Tag = item;
                    //radHeaderButton.AutoSize = true;
                    //radHeaderButton.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
                    radHeaderButton.FitToSizeMode = RadFitToSizeMode.FitToParentBounds;
                    //radMenuGroup.Items.Add(radHeaderButton);
                    radMenuGroup.Bounds = new System.Drawing.Rectangle(0, 0, radMenuGroup.Size.Width + 70, 58);
                    radMenuGroup.Items.AddRange(new Telerik.WinControls.RadItem[] { radHeaderButton });
                    radHeaderButton.FitToSizeMode = RadFitToSizeMode.FitToParentBounds;
                }
            }
            radMenuGroup.Visibility = ElementVisibility.Visible;
            //radMenuGroup.AutoSize = true;
            return radMenuGroup;
        }


0
Peter
Telerik team
answered on 06 Jul 2011, 11:54 AM
Hi Himanshu,

Thank you for the question and for the provided sample code.

The nested RibbonBar elements do not support AutoSize set to False mode, they should always have AutoSize set to True, and if you want to set element sizes, you have to set MinimumSize and MaximumSize.

So you should change your code accordingly:

private RadRibbonBarGroup radCreateMenuItems(IGrouping<string, PlugInHost> hostGroup, bool visiblisity, int Length)
       {
           RadRibbonBarGroup radMenuGroup = new RadRibbonBarGroup();
           radMenuGroup.Text = hostGroup.Key;
           radMenuGroup.Name = hostGroup.Key;
           radMenuGroup.AccessibleDescription = hostGroup.Key;
           radMenuGroup.AccessibleName = hostGroup.Key;
           radMenuGroup.MinimumSize = new System.Drawing.SizeF(0, 0, 90, 58);
           if (Length == 1)
           {
               RadButtonElement radHeaderButton = new RadButtonElement();
               radHeaderButton = radCreateMenuItem(hostGroup.First());               
               radMenuGroup.Tag = hostGroup.First();
               radHeaderButton.TextImageRelation = TextImageRelation.ImageAboveText;
               radHeaderButton.ImageAlignment = ContentAlignment.TopCenter;
               radHeaderButton.TextAlignment = ContentAlignment.MiddleCenter;
               radHeaderButton.Tag = hostGroup.First();
               radMenuGroup.Margin = new System.Windows.Forms.Padding(0);
               radMenuGroup.Items.Add(radHeaderButton);
           }
           else
           {               
               radMenuGroup.Visibility = ElementVisibility.Visible;
               ribbonTabPlugIns.Items.Add( radMenuGroup );
               foreach (var item in hostGroup)
               {
                   //radMenuGroup.Size = new System.Drawing.Size(100, 50);
                   RadButtonElement radHeaderButton = new RadButtonElement();
                   radHeaderButton.Text ="       " + item.ToString() + "       ";
                   radHeaderButton.ToolTipText = hostGroup.Key+ ":      " + item.ToString() + "       ";
                   radHeaderButton = radCreateMenuItem(item);
                   radHeaderButton.TextImageRelation = TextImageRelation.ImageAboveText;
                   radHeaderButton.ImageAlignment = ContentAlignment.TopCenter;
                   radHeaderButton.TextAlignment = ContentAlignment.MiddleCenter;
                   radHeaderButton.Tag = item;
                   //radHeaderButton.AutoSize = true;
                   //radHeaderButton.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
                   //radMenuGroup.Items.Add(radHeaderButton);
                   radMenuGroup.MinimumSize = new System.Drawing.SizeF(0, 0, radMenuGroup.Size.Width + 70, 58);
                   radMenuGroup.Items.Add( radHeaderButton );
               }
           }
           radMenuGroup.Visibility = ElementVisibility.Visible;
           //radMenuGroup.AutoSize = true;
           return radMenuGroup;
       }

If you continue to experience the issue, please send a sample project where issue can be reproduced.

All the best,
Peter
the Telerik team
Registration for Q2 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting July 18th and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
RibbonBar
Asked by
UIdev
Top achievements
Rank 1
Answers by
Ralf Ehlert
Top achievements
Rank 1
UIdev
Top achievements
Rank 1
Jack
Telerik team
Himanshu
Top achievements
Rank 1
Peter
Telerik team
Share this question
or