In my case I have inherited from UltraCombo and named it comboBase and then inherits all other combos, for example combo1, from comboBase. Everything works as expected! However, now I want to add ButtonRight to combo1 but it is not adding it. I then add ButtonRight to comboBase, hoping that I can hide the right button in some child combos in case I do not need the RightButton but it adds two ButtonRight when I add only one!
I first need to know if it is possible to add ButtonRight to combo1 that inherits from comboBase. If it is not possible, I need to know why it adds two ButtonRight to combo1 when I add only 1 combo to comboBase and how to hide the ButtonRight in combo1!
I have added a project as an example.
Thank you
Hi,
I'm afraid I do not understand your questions. What does the grid have to do with it? What's not working?
It seems that my Grid that is inherited from the UltraWinGrid does not work but it works on the original UltraGrid! Any idea?
This worked fine in User form, but when I added that combo to the WinGrid it does not work. The OnCreate is called for the grid, but it is not created!
Thank you.
Hi Alex,
The ButtonsRight collection is public and it gets serialized by the designer. So if you add a button to the designer in the combo1 class, then when you open the Form designer, the form designer will see the button and serialize it. The next time you open the designer, it will get added by both the combo1 designer code and the Form code.
This is basically one of the limitations of visual inheritance in Visual Studio. It will happen with any control that has a public collection. You can duplicate the same sort of behavior using Nodes in a TreeView control, for example.
I think you can get around this by not adding the button through the designer, but instead, add it in code in the OnCreateControl method. This way it only gets called when the control is created the first time.
public partial class UserControl1 : Infragistics.Win.UltraWinGrid.UltraCombo { public UserControl1() { InitializeComponent(); } protected override void OnCreateControl() { base.OnCreateControl(); EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton(); editorButton1.Text = "a"; this.ButtonsRight.Add(editorButton1); } }