Code below is a Design Time code.
It allows to add my tab pages to the tab control inherited from UltraTabControl.
Design Time behavior sufficient so far, but not perfect ( until I click on first-tab-page, click does not do same for second tab page ).
Anything else has to be done to set up tab page or tab control or tab for all this to work properly at Design and Run Time ?
myTab.TabPage = new MyTabPage();
MyTabControl.Controls.Add(myTab.TabPage);
MyTabControl.Tabs.Add(myTab);
public class MyTabPage : Infragistics.Win.UltraWinTabControl.UltraTabPageControl
and
public class MyTabControl: Infragistics.Win.UltraWinTabControl.UltraTabControl
Thank you
There is MyTabControl inherited from UltraTabControl
When MyTabControl is used = dropped on the form and tabs are added using properties window ( Design Time) ,
code is generated in designer.cs file.
Some of generated code uses UltraTabPageControl type, UltraTab type and other Ultra types.
What would be the proper way to "turn off" generation of Ultra... types in designer.cs
And have MyTabControl work properly at Design time and at Run time ?
You can try setting your derived UltraTabControl's SharedControlsPage in the constructor of your tab control. That way the tab control won't lazily create it shared control page and create an UltraTabPageControl. Also, what problem are you having with the normal UltraTabPageControl? Maybe you can work around it without having to create a derived control.
Again, I would try to get permission to break the policy for the UltraTabControl because you are very likely to introduce bugs trying to use all derived types like this. If you must have all custom types in the designer code, use the regular designer support to design your tab control, close the designer and then do a find-replace in the designer code behind file to replace all Ultra... types with your derived equivalents.
It is "cannot have 3rd party types created in the designer code".
I have tried also to wrap UltraTabControl completely ( deriving MyTabControl from UserControl, etc...). but design-time UI functionality was lost.
Tabs became unclickable, etc. It looks like in that case I would need to derive my designer from ParentControlDesigner ( as I guess ParentControlDesigner is the one UltraTabControl is using), but I have read that it is very easy to break something when you overwrite designers and debugging is difficult. Tab control is very much visual control and at design time it is a must to have UI features working.
So I have tried to use deriving, and so far it looks like I made it work except sharing page.
Do you know if somebody was successfull in complete wrapping of UltraTabControl ( deriving from UserControl, etc...) and deriving from ParentControlDesigner to code design time UI features (like switching tabs, etc... ?
Thanks again
I'm sorry that didn't work. However, I am a little confused. Is it your company's policy that you cannot have 3rd party controls and components created in the designer code, or that you cannot use them at all in your apps. If it is the latter, then I would think you are still in violation of the policy even if you do manage to use all derived controls. You are still using our logic for your derived types. But if you just cannot have 3rd party types created in the designer code, I would try to get permission to break the policy in this case. You are more likely to introduce a new bug by trying to derive from the types and mess with the designer generated code.
I've tried to create shared controls page in ctor like the following :
public MyTabControl() : base() { MySp = new MyTabSharedControlsPage(); base.Controls.Add(MySp); base.SharedControlsPage = MySp; }
but I get error :
"Failed to create Component MyTabControl. The message error follows: System.InvalidOperationException: Once initialized the SharedControlsPage property of an UltraTabControl can not be changed."
It sound like that page was created during call to base().
And it is policy of our company not to have third party control's types in our apps and automatic creation of UltraTabSharedPage generates code in *.designer.cs with "Ultra" type. I have tried hundred ways to hide it.
I also did try to remove automatically created page and create MySharedControlsPage derived from UltraSharedControlsPage and attach it to tab control, but it does not work : tells me that TabPage property is read only.
Thanks again for taking time to reply