Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
730
Redundant code generated while adding Tools on toolBarManager
posted

I've added a popup menutool on a ribbonbar and then added a button tool in that popup menu tool. The code generated by designer is:

Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("ViewFile");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("ViewFile");

ribbonGroup1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[     {    
                                            popupMenuTool1
                                        });

Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool1");

Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("ButtonTool1");


popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[
                                        {
                                            buttonTool1
                                        });

buttonTool2.SharedProps.Caption = "ButtonTool1";

this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[
                                        {
                                            popupMenuTool2,
                                                    buttonTool2
                                        });

It seems that designer is creating a copy of every tool placed on Ribbon. When i deleted the button tool the designer deleted the buttonTool1 but didnt delete the buttonTool2 which was a copy. Im used to adding and deleting controls in which case there will a lot of redundant code generated resulting in performance hit.

Why is that a separate copy of every tool being added on ribbon is created and on deletion the copy is actually not deleted from the code?

Thnks,

--Ayub