Two questions about making the PopupGalleryTool look nice.
1. In the screenshot you see a PopupGalleryTool with a gray line at the bottom, marked in pink. It may be a left-over of the ResizeDropDown. How can I get rid of the gray line and the space it occupies?
2.There is empty white space to the right of the items, marked in red. How can I get rid of that space?
I've been searching for answers to these question without success. Even if the answers were in the forum, I have a hard time coming up with the proper search terms. What is the strategy for finding answers to such questions?
TIA!Hans
Hi Michael
>> At this time do you have any additional questions?
No, thank you, not at this point.
Best,Hans
Hello Hans,
I am glad you were able to determine a viable solution to address your request. At this time do you have any additional questions?
The PopupGalleryTool Class inherites PopupMenuTool and it's members. So what you are doing is fine and will allow you to include gallery items as well like you have in your illustration.
Some more tweaking:
We can further reduce the width of the drop-downs by going to
ultraToolbarsManager1.ImageSizeSmall = new Size( -24, 0 );
but this causes the captions to move to the left and be clipped.
(Interestingly, the presence of GalleryToolItems limits the amount by which we can decrease the width -- they insist on keeping minimum width plus the white area on their right.)
The following DrawFilter in the UltraToolbarsManager (along with using ButtonTools and ImageSizeSmall) finally gives me what I want (see screenshot):
class DrawFilter : IUIElementDrawFilter { public bool DrawElement( DrawPhase drawPhase, ref UIElementDrawParams drawParams ) { if ( drawParams.Element is TextUIElement && (drawParams.ControlElement is PopupGalleryControlUIElement || drawParams.ControlElement is PopupMenuControlUIElement) ) { var rect = drawParams.Element.Rect; rect = new Rectangle( new Point( drawParams.Element.Parent.Rect.X + 4, rect.Y ), rect.Size ); drawParams.Element.Rect = rect; } return false; } public DrawPhase GetPhasesToFilter( ref UIElementDrawParams drawParams ) { return DrawPhase.BeforeDrawForeground; return DrawPhase.None; } }
Thank you for your help, Michael.
Well, using ButtonTools throws us back to http://ko.infragistics.com/community/forums/t/90316.aspx
As we've seen there, we can remove the IconArea with
ultraToolbarsManager1.ImageSizeSmall = new Size( -7, 0 );
After that, we have what you see in the attached screenshot.
The advantage of the ButtonTools over the GalleryToolItems is that the highlighted area extends the full width, but the extraneous space on the right remains.
What is the advantage of using a PopupMenuTool over a PopupGalleryTool? It seems to look the same.
Hello Salvis,
Have you tried adding ButtonTools instead of items to your gallery tool?
Both the PopupMenuTool and PopupGalleryTool can contain several child tools to get the behavior your looking for. Adding "items" within a PopupGalleryTool is bit more robust and meant to used along side with the Ribbon, ex you can add charts and other controls as shown in our documentation here: http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=WinToolbarsManager_Adding_Groups_and_Items_to_the_PopupGalleryTool.html
I believe the best and most direct way to achieve your requirement would be to simply add button tools to your PopupGalleryTool. But it would be better to begin with using the PopupMenuTool if you only want to add items as a list that are clickable like ButtonTools and see if it has everything you need.
I attached your sample which I modified to show you how to add the desired behavior, in code, with button tools added to your PopupGalleryTool.
Let me know if you have any questions regarding this matter.