Hello,
I have a WinfForms dialog that presents the same drop-down menu options in two different areas - one within an UltraDropDownButton, and the other within the toolbar itself.
Even though both of these areas share a drop-down menu, I need to know which is the source within the ToolClick event.
Does anyone know how to do this? My original thought was that I could just set a flag when the dropdown button opens, and then reset it when it closes - but unfortunately it closes before the ToolClick event is fired, which makes that approach infeasible.
Any help would be greatly appreciated.
From within the ToolClick event handler, there is no specific way to determine the control for which the context menu belongs. However, the BeforeToolDropDown event should fire when the context menu (PopupMenuTool) is displayed. The event args for this event provides the SourceControl which is the control triggering the event. So if you handle this event and keep a reference to the control (or an indication of the control), you can then check the control in the ToolClick event handler.
If you require further assistance regarding this behavior, feel free to ask.
Thanks,
Chris
Did you figure out how to differentiate between the ultradayview and ultraweekview? I have multiple charts (not Infragisitics charts) on a WinForm. All of them have the same context menu (which is an Infragistics PopupMenuTool). How do I know from ToolbarManager_ToolClickEvent which chart the context menu was displayed on?
Hi, I have the same trouble. I have the popupmenutool on ultradayview and ultraweekview. How can I know the source?
When displaying the child tools of a PopupMenuTool in a context of other than a UltraToolbar (such as a context menu or the dropdown of the UltraDropDownButton), the UltraToolbarsManager displays the root tool, and not the instance tool which is displayed on the toolbar.
In your scenario, the first thing you'll need to do is find the top-level tool being used for the display (PopupMenuTool) by recursively checking the Owner property until it is not of type ToolBase. Once you get this tool, you can check the IsRootTool property to determine if it is an instance tool (i.e on a UltraToolbar) or a root tool (i.e being displayed as a dropdown/context menu).
<within the ToolClick event handler>
ToolBase tool = e.Tool; while (tool.Owner is ToolBase) tool = tool.Owner as ToolBase;
if (tool.IsRootTool) { // Perform UltraDropDownButton Tool Click functionality } else { // Perform UltraToolbar Tool Click functionality }
If I can assist you with any other questions regarding this scenario, please don't hesitate to ask.