Hi all,
Interesting that the Tag property isn't persisted across when you create a StateButtonTool.
string tag = "StringFilter";
...
Infragistics.Win.UltraWinToolbars.StateButtonTool btnTool = new Infragistics.Win.UltraWinToolbars.StateButtonTool(key + "|" + clbi.Name); btnTool.SharedPropsInternal.Category = "Filter"; btnTool.SharedPropsInternal.Caption = clbi.DisplayName; btnTool.Tag = tag; toolBase[i] = btnTool;
return toolBase;
At this point the Tag is "StringFilter"
But after adding the toolBase to the Toolbar.Tools collection:
this.ToolBar.Tools.AddRange(toolBase);
it disappears. toolBase does have the tag property set, this.ToolBar.Tools does not.
I'm wondering if something wasn't copied over internally.
I kinda need that property :( or another i can set that isn't visible in the UI.
Hi Glenn,
That is correct. You have to add PopupMenuTool into ToolbarsManager tools collection, in order to add it to any other tool container. ToolbarsManager has to be aware of all tools, in order to utilize the shared props collection of settings for example. At first glance, it may look redundant but this way you can easily synchronize all tools despite how deeply nested they are in each tool container. So yes, your assumption about the way to create tools is the right way to go.
Let us know if you need further assistance regarding this matter.
Screenshot.
Thanks for the response. I'd like to start off by saying I'm doing things unconventional and learning the infragistics controls at the same time. My end goal is to write a custom control which uses the ToolBarManager to add custom filtering to an UltraGrid. So far I'm able to display a custom designer (ControlDesigner) that list the initial filter options that are generated from the columns of the grid. Kinda stuck at implementing the changes back to the winform but that's not an infragistics issue.
Now having said all that. I've gotten as far as generating the initial list of PopupMenuTools with attached StateButtonTool(s). The tag seems to clear off. I have the feeling I'm doing it wrong so feel free to correct my evil ways. I was able to get around this by using the StateButtonTool.SharePropsInternal.Tag.
So, a couple of things come to mind; I've noticed that I have to add the PopupMentTools (toolbase collection) to the ToolbarManager before I can add them to the desired PopupMenuTool (FilterMenuTool) and then add them to the PopupMenuTool (FilterMenuTool). So it looks redundant. It's there is a better or correct way of doing this please point it out for me.
I did see the AddTool on the PopupMenuTool. If I try to use that instead, would I need to do the following?:
a) Create 1 copy of each StateButtonTool in the ToolBarManager ( Between, BeginsWith, et al )
b) Assign each StateButtonTool to a PopupMenuTool (.AddTool(key))
The end goal is to allow the developer to change the PopupMenuTools and StateButtonTools at design time w/o having to alter the CustomControl. Right now I have the initial list being generated once an UltraGrid is assigned to the control via properties window or designer verb, getting that pushed back down is proving to be a challenge.
Hello Glenn,
Based on the code snippet you provided I created a small sample project to test this behavior. When I run my sample project, I was unable to reproduce this behavior. The tag of the tool retained its value, after the tool was added to toolbars manager’s tools collection. Attached is the sample project I tested this with as well as a video I recorded during my test.
Please run this sample at your side and let me know if you face the same issue. If you are able to reproduce this behavior, it most probably shows to a different in versions we are using or an issue in your environment. My test was performed with Infragistics for Windows Forms 2016 volume 2 with latest service release. Can you let me know the exact version of Infragistics you are using?
If the sample does not shows the behavior you are describing can you provide a small sample project that shows this behavior. Alternatively, if my sample does not correctly reproduce what you are trying to achieve feel free to modify it and send it back to me.
Looking forward to your reply.