Regards,
4 Answers, 1 is accepted
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
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
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?
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