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

Context Tab Group Length truncates text

4 Answers 97 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 08 Nov 2012, 07:50 PM
I've set up a Context Tab Group which contains at least 1 tab.  The Name of the tab is shorter than the name of the Context Tab Group name.  This results in the Context Tab Group not fully displaying the name.  It appears that the width of the Context Tab Group takes on the width of all the children tabs associated to it.  How can I lengthen the width of the Context Tab Group to fully display the text regardless of cumulative width of the children tabs?  I've done some trial and error with the AutoSize, AutoSizeMode, and FitToSizeMode to no avail.

Regards,

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 13 Nov 2012, 07:22 AM
Hi Jeremy,

Thank you for writing.

The width of the ContextualTab is determined by the size of the tabs that it contains and it cannot be changed. It will always be exactly as wide as the size of its containing tabs. See attached image. 

More information can be found here: http://www.telerik.com/help/winforms/ribbonbar-creating-and-using-contextual-tab-groups.html.

I hope that you find this information helpful.
 
Regards,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Stefan
Telerik team
answered on 13 Nov 2012, 07:22 AM
Hi Jeremy,

Thank you for writing.

The width of the ContextualTab is determined by the size of the tabs that it contains and it cannot be changed. It will always be exactly as wide as the size of its containing tabs. See attached image. 

More information can be found here: http://www.telerik.com/help/winforms/ribbonbar-creating-and-using-contextual-tab-groups.html.

I hope that you find this information helpful.
 
Regards,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Jeremy
Top achievements
Rank 1
answered on 15 Nov 2012, 07:00 PM

Hi Stefan,

Thanks for your response.  I've tried a couple of scenarios (work-arounds) attempting to get better control of the context group size.  I noticed in the designer that I can set the AutoSize=False, and then change the now-enabled Bounds settings. This does give control to set the width of the context greater than the tab(s) contained in it.  However, we've got a scenario that requires creating tabs and context items in codebehind during runtime.  I attempted to replicate the designer scenario in the runtime mode and was unsuccessful.  I could set the AutoSize=False and change the Bound settings, but it appears that the "Rendering Engine" is circumventing my manual settings. 

Is there some event that I can effectively subscribe to and readjust the widths?

Also, on another tack, I attempted to hack the width of the child(ren) tab(s) associated with the context.  The goal was to pad empty spaces in the tab text to equal that of the length of the context text.  So if my context text had a length of 10 and my tab text had a length of 4, that would leave 6 characters in difference.  My goal was to pad 3 spaces on the right and 3 on the left.  Effectively changing the string length of the tab text and consequently forcing the width of the tab to ensure all the characters of the context text were displayed.  I discovered that there is something in the "Rendering Engine" that trims off the string only on the right side.  So my result would be 3 added spaces on the left but the 3 spaces I added on the right get removed at some point after the tab is created and associated to the ContextTabGroup  Is the trimming of strings (for tabs, or even other controls) built in by design?  Is there a workaround?  Is there a way to stop the Trimming from happening?

0
Stefan
Telerik team
answered on 20 Nov 2012, 10:13 AM
Hi Jeremy,

Thank you for writing back.

In regards to the first approach, the control logic will not allow such a resizing and it will try to follow its standard layout logic. There is now suitable event for this.

In regards to the extra spaces approach, it will also not work, as the text will be trimmed as you noticed.

What I can offer is to manually increase the width of the ribbon tabs in the desired contextual tab group, by setting their MinSize property and perform a layout:
private void radButton1_Click(object sender, EventArgs e)
{
    ribbonTab1.MinSize = new Size(ribbonTab1.Size.Width+60, 0);
    radRibbonBar1.RibbonBarElement.InvalidateMeasure(true);
    radRibbonBar1.RibbonBarElement.UpdateLayout();
    radRibbonBar1.RibbonBarElement.RibbonCaption.CaptionLayout.InvalidateMeasure(true);
    radRibbonBar1.RibbonBarElement.RibbonCaption.CaptionLayout.UpdateLayout();
}

I have also added a feature request in our Public Issue Tracking System, so the users can vote for such a functionality: http://www.telerik.com/support/pits.aspx#/public/winforms/13514

I hope this helps.

Regards,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
RibbonBar
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Jeremy
Top achievements
Rank 1
Share this question
or