Hi
Im not sure if the following is possible. I currently have a popup menu which can have a single optiion or many. For example I have a "Create Record" menu. In some situations (driven by data) there are many different ways to create a record so we have "create record" as a popup with the options. I have made this a segmented popup so that a click of the popup menu means a selection of the first button in the popup's tools collection.
That works well. In many situations there is only a single option and it is something generic. For example the single button tool under "Create Record" is "Create Record". I would like to make this single button invisible so that the "Create Record" popup menu looks and behaves like a button. I can get this working nicely as long as I set Visible to FALSE on the button and the button is enabled.
I have made the popup segmented so this works and stopped the dropdown arrow from doing anything with a beforetooldropdown event. How do I get rid of the popup arrow altogether? I want to be able to get rid of it in these sutuations. Is this possible with a drawfilter? Settings the dropdownarrowstyle to None seems to imply Standard and anythig other than segmented does not raise a toolclick event on the popup which I need to emulate a button.
Any help is greatly appreciated.
Thanks
Darren
Darren,
You would need a CreationFilter to remove that arrow. I have attached a very simple sample application to this forum thread which I hope will give you an idea of what you could do. Let me know if you have further questions.
Thanks.
I'll give it a try.
-Darren
Hello Darren,
I started to put together a sample that includes an MDIParent/Child scenario. The arrows stay hidden with the creation filter therefore I would like for you to modify the sample to reproduce the behavior your are having issues with. Let me know if this is possible.
When you run the sample you will see a button to "Add child form", this will create a new ribbon tab that includes a PopupMenu tool.
Ive changed your example to include your popup which demonstrates my issue. Please open the child form and right-click on the ultrabutton. A popup will show wth an embedded popup menu and a button. I need to get rid of the arrow on this popup menu.
The arrow on the popup menu is exposed from PopupMenuItemUIElement. So the hierarchy is a little different in this situation. Please modify the creation filter's if statement in the sample which should answer your question.
if (parent is ArrowUIElement && parent.Parent is PopupToolDropDownButtonUIElement || parent is ArrowUIElement && parent.Parent is PopupMenuItemUIElement) { parent.Parent.ChildElements.Remove(parent); }
Let me know if you have any questions regarding this matter.
Thats great and now works fine. I now meed to tweak this to make it fit in with the functionality I need. I can stop the arrow from appearing but need to do this programatically. I can also see that on removal that the segmented separator also disappears which is great too.
is there a way to get back to the original popupmenu tool from the uielement. If this is possible I want to only remove the arrow uielement when there is a single button on the popup menu but not remove the arrow when multiple entries are present on the popup menu. The reason for doing this is that I want to make the popupmenu behave like a button in these rare situations where there is only a single option.The client has complained about it looking cumbersome when only one option is present.
If I understand your question correctly, {is there a way to get back to the original popupmenu tool from the uielement}?
I believe you can use the GetContext method to figure out when you have popupmenu and handle your custom logic. There is an example in our documentation regarding this concept.
http://help.infragistics.com/Doc/WinForms/Current/CLR4.0/?page=Infragistics4.Win.v13.2~Infragistics.Win.UIElement~GetContext(Type).html
Let me know if this helps, otherwise please clarify your request.
Its OK I sorted it. I was able to use getContext to retrieve the parent toolbar manager and then use activemdichildmanager to get to the toolbar on my mdi child etc.
Thanks for all your help.
Regards
That seems to work up to a point. The popup tool that gets returned from a call to getcontext seems to be a placeholder merge tool. How is it possible to get hold of the popuptool object in the mdichild. The creation filter is attached to the mdi parent and so I guess it makes sense for getcontext to return what it does?
We're nearly there but I guess I just need this bit.