Hi, this is a simple question that I can't figure out. I created a new Windows Forms project, dropped an UltraToolbarsManager on the form (and added an UltraPanel set to dock fill per the pop-up warning), then added a ribbon tab and group. In the group, I added three ButtonTools. I want their border to be red. How do I do this?
In the designer Custom Property Pages for the UltraToolbarsManager, if I set the Appearance.BorderColor of the ribbon group to Red, it automatically turns it red right there while I'm watching. I have tried every Appearance I can think of for the button tool, but can't find one that turns the border red.
Any ideas?
Thanks,
J
Does anybody have any thoughts on this? I still can't seem to get it to work.
Hi Jammerms,
Can you please tell me which NetAdvantage version you are using?
ThanksPurnima
10.3
Hello,
I have confirmed this behavior and logged it as a development issue.
Hello.
The DrawFilter and CreationFilter properties don't exist on the button itself or on any other part of the control; they exist on the root control object, which in this case is the ultraToolbarsManager, because they can apply to any part of the control at any time. I was going to instruct you on getting a reference to the button tool that the ButtonToolUIElement refers to and then determine if that is the correct button, but you have already figured that out.
When you employ a draw filter or a creation filter in your project you have to determine which part of the control you are referring to from the UIElement that is being drawn. A toolbar can have many tools and you need to get a reference to the tool itself to determine if you want the draw filter to take over. A WinGrid can have many cells and you will need to get a reference to the specific cell from the CellUIElement to determine if you need to apply the draw filter, etc.
Please let me know if you have any further questions.
Well, I was asking for a DrawFilter for the ButtonTool itself. Not the toolbar manager.
In the ToolbarManager - I have - Text buttons, groups, checkboxes and icon+text buttons. Now I want to pick and choose which button should have border and which ones should not. I cant globally apply border to all items.
But I found it. I can put a check inside DrawElement as what button it is and apply the border accordingly.
A shorter of doing this would be appreciated. But good for now.
I have attached a working sample with the draw filter code above included. The DrawFilter property exists on all Net Advantage Windows Forms controls. In the sample you'll see this line of code in Form_Load where we set the DrawFilter property:
this.ultraToolbarsManager1.DrawFilter = new DrawFilter();
A draw filter is simply a class that implements the Infragistics.Win.IUIElementDrawFilter interface. To set the DrawFilter property on an Infragistics Net Advantage control, you simply set the property to an instance of a class that implements it. This interface has two methods: GetPhasesToFilter and DrawElement. GetPhasesToFilter is where you tell the control which parts of the drawing you want to take over and DrawElement is where the actual drawing is done.
In the sample, you'll see that GetPhasesToFilter simply returns DrawPhase.BeforeDrawBorders because this is the only part of the drawing that we want to take over. In DrawElement, we check the DrawPhase to make sure it is BeforeDrawBorders and if so, we then check to see which element is being drawn. If we are drawing a ButtonToolUIElement, then we simply invoke drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.All, Color.Red, rect, rect). In the code I chose the color red and a solid UIElementBorderStyle, however you can choose any color or border style that you like.
Please let me know if you have any questions.
And where is the DrawFilter property of the ButtonTool?
How do we use even the DrawFilter class that you have specified?
Charlie,
It sounds like you are saying that the ToolbarButton has properties (via its appearance) that are not able to be used because the class that actually draws the tool (the ButtonToolUIElement) is not coded to do so. That sounds like a pretty straightforward bug: the property is available to be set but is not actually implemented.
Yes, please submit a 'feature request' to honor the existing appearance properties of the ToolbarButton. I see how to use the work-around provided for drawing a red rectangle; if I need to set BorderAlpha or BorderColor3DBase, then I'll write in again.
Thanks again for your help,