Creating the tab and adding the controls was easy. Very easy actually. However, using"special characters" such as "'/" and "(" or ")" in the labels caused the entire tab to not be displayed. No error message, no log, just poof - ribbon gone. Sweet. I tried escaping the characters xml style, but that caused even more problems. I created a ribbon using the Visual Studio 2008 Ribbon Designer. The code I had written looked almost exactly like the code there. Well crap. I Googled the living snot out of the problem and couldn't find a damn thing. I asked team members. I stared at the ceiling. I mediated about it. I even programmed myself to dream about it. Actually, I gave up at the ceiling staring stage, but you get the idea.
Well, today I was looking through the designer code for the ribbon, and it had calls to ribbon.SuspendLayout(), ribbon.ResumeLayout(False) around the calls to add the ribbon controls. I didn't think this would do anything, but hey - why not give it go? Sure enough, that fixed my problems.
So, in summary, do this:
ribbon.SuspendLayout()and everything will be fine.
... 'Add a bunch of tabs, groups, controls, etc
ribbon.ResumeLayout(False)
No comments:
Post a Comment