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
555
toolbutton.InstanceProps = null, can't set IsFirstInGroup = true;
posted

The following code shows what I' am try todo: I want to initialize a popup menu with a couple of menu item programmatically. Some of them should be regrouped and the group should be separated by horizontal separator lines:

ultraToolbarsManager > ultraToolbar > popup >

menu item1

menu item2

--------------------------------

buttonToolGenerateHA

menu item3

menu item4

 

ultraToolbarsManager "ultraToolbarsManagerDP" contains a ultraToolbar "ultraToolbarDP" to which a popup menu "popupFunctions" containing the menu (buttontool) item "buttonToolGenerateHA" should be appended

before the menu item a separator line should be placed, why I set the IsFirstInGroup property to true.

I tried different combination, actually I can't set the property, either  buttonToolGenerateHA.InstanceProps is null or setting the IsFirstInGroup property is ignored. The menu item are displayed without separator

Any idea to init the tools correctly programmatically?

----------------------------------

//>>> buttonToolGenerateHA.InstanceProps != null

 

           

ultraToolbarDP.NonInheritedTools.AddRange(new ToolBase[] { popupFunctions,});

          

ultraToolbarsManagerDP.Toolbars.AddRange(new UltraToolbar[] { ultraToolbarDP, });

        

//>>> attach Tools to the Toolbar manager

 

ultraToolbarsManagerDP.Tools.Add(buttonToolGenerateHA);

 

//>>> buttonToolGenerateHA.InstanceProps = null!

                

popupFunctions.Tools.Add(buttonToolGenerateHA);

 

???  when to set buttonToolGenerateHA.InstanceProps.IsFirstInGroup = true; ???

Parents
No Data
Reply
  • 6158
    Verified Answer
    Offline posted

    Hello,

    Before I explain what is happening and how to resolve your issue, I suggest reviewing the "Root Tools and Instance Tools" section provided in our online help to familiarize yourself with these items.

    When you add a tool (buttonToolGenerateHA) to the PopupMenuTool's Tools collection, you are adding the root tool. When it is added, it is cloned and an instance tool is inserted into the collection. As 'buttonToolGenerateHA' is still referring to the root tool, it does not have a InstanceProps available. To access the InstanceProps, you'll need to index (by index or key) into the Tools collection of the PopupMenuTool.

    popupFunctions.Tools[buttonToolsGeneratedHA.Key].InstanceProps.IsFirstInGroup = true;

     

    I hope this helps. Let me know if you need further assistance.

    Thanks,

    Chris

Children