how to add a control(like a button) in UltraExplorerBar Groups header?
Two problems I see is (1) you are adding the ButtonUIElement to the control's UIElement (you need to add it to the group's header element) and (2) you never set the ButtonUIElement's Rect property.
There is a related thread here shows the general approach for implementing the IUIElementCreationFilter interface that UltraExplorerBar.
Hello,
I would need to do pretty much the same thing, and that is, to place a button on the top right side of a UltraExplorerBar. When this button is pressed, I need the UltraExplorerBar control to be closed.
As a button, I used a ButtonUIElement.
In my UltraExplorerBar control, there are also 3 groups.
My problem is that the button does not show up on my UltraExplorerBar. The 3 groups seam to apper alright.
Here is a slice of code:
Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar ctlExplorerBar;
ctlExplorerBar = new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar();
UltraExplorerBarGroup BarGroup1 = new UltraExplorerBarGroup();UltraExplorerBarGroup BarGroup2 = new UltraExplorerBarGroup();UltraExplorerBarGroup BarGroup3 = new UltraExplorerBarGroup();
ctlExplorerBar.Groups.AddRange(new UltraExplorerBarGroup[] {BarGroup1, BarGroup2, BarGroup3});
Infragistics.Win.ButtonUIElement btnClose;btnClose= new Infragistics.Win.ButtonUIElement(ctlExplorerBar.UIElement);
btnClose.Text = "Close";
ctlExplorerBar.UIElement.ChildElements.Add( btnFermer );
Could you please indicate what need to be done in order for the button to appear? Also could you please inform me how to place it on the top right side of the UltraExplorerBar control?
Strictly speaking the answer to your question is to add the control to the UltraExplorerBar's Controls collection, and position it based on the bounds of the header. UltraExplorerBar' supports an interface, Infragistics.Win.IUIElementCreationFilter, which provides a way to add UIElements (ButtonUIElement being among these) to any UIElement already present within the control. The following KB article demonstrates how to remove the expansion indicator from a group header, so you could expand on that code to add a UIElement of type Infragistics.Win.ButtonUIElement to the group header.