Hello,
I've got a couple Ultradropdownbuttons in a form. Wired up and working fine. The only issue is one of space. I need to get all the reduction in size I can out of this and to that end I would like to not show the dropdown arrow at all. The control is replacing a standard button and I'd like to have the Ultradropdownbutton take up the same screen real estate as the standard Ultrabutton with a 16x16 image and no text, no dropdown arrow. The buttons' style is set to DropDownButtonOnly.
Any ideas?
Hi,
There's no property to remove the dropdown arrow. But there are a couple of approaches you could take here.
One approach would be to remove the dropdown arrow using a CreationFilter. This is not too difficult, but there may be a bit of a learning curve if you haven't used CreationFilters before.
Another approach would be to use a different control. You could, for example, use a regular UltraButton or maybe an UltraCheckEditor in Button style. With this approach, you would have to handle events and show the dropdown in code, of course.
Thanks for the reply Mike. I ended up using an UltraButton and handling the events myself. For my instruction though, perhaps you'd take a look at the following:
I attempted to use a creation filter, but there doesn't appear to be a good way to do this with the UltraDropdownButton control. Or at least, if there is, I'm missing it.
I first tried:
Friend Class NoDropDownButtonCreationFilter
Implements Infragistics.Win.IUIElementCreationFilter
Public Sub AfterCreateChildElements(parent As Infragistics.Win.UIElement) Implements Infragistics.Win.IUIElementCreationFilter.AfterCreateChildElements
Dim editorElement As Infragistics.Win.Misc.DropDownButtonControlUIElement = CType(parent, Infragistics.Win.Misc.DropDownButtonControlUIElement)
If editorElement IsNot Nothing Then
Dim dropdownButtonElement As Infragistics.Win.DropDownButtonUIElement = CType(editorElement.GetDescendant(GetType(DropDownButtonUIElement)), DropDownButtonUIElement)
Dim textElement As Infragistics.Win.EditorWithTextUIElement = CType(editorElement.GetDescendant(GetType(EditorWithTextUIElement)), EditorWithTextUIElement)
If dropdownButtonElement IsNot Nothing AndAlso editorElement.ChildElements.Contains(dropdownButtonElement) Then
editorElement.ChildElements.Remove(dropdownButtonElement)
If textElement IsNot Nothing Then
textElement.Rect = editorElement.RectInsideBorders
End If
End Sub
Public Function BeforeCreateChildElements(parent As Infragistics.Win.UIElement) As Boolean Implements Infragistics.Win.IUIElementCreationFilter.BeforeCreateChildElements
Return False
End Function
End Class
However, the parent only has one ChildElement which is Infragistics.Win.Misc.SplitButtonUIElement. There are no ChildElements on that class so I see no way to remove one of them from the collection. Do you have any suggestions about where to hide the dropdownbutton in this case?
Hi Mike,
this works, thank you!
Best regards,
Daniel
Hi Daniel,
It looks like either the elements changes over the years, or else I made a mistake in my original code. I sed the wrong UIElement there. You have to use SplitButtonDropDownUIElement instead of SplitButtonUIElement.
public class MyDrawFilter : IUIElementDrawFilter{#region IUIElementDrawFilter Members public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams){return true;} public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams){if (drawParams.Element is SplitButtonDropDownUIElement)return DrawPhase.BeforeDrawForeground; return DrawPhase.None;} #endregion}
public class MyDrawFilter : IUIElementDrawFilter{#region IUIElementDrawFilter Members
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams){return true;}
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams){if (drawParams.Element is SplitButtonDropDownUIElement)return DrawPhase.BeforeDrawForeground;
return DrawPhase.None;}
#endregion}
i also need an UltraDropDownButton in our application, which can hide/show (or enable/disable) the drowdown-arrow on demand. I've tried your suggested the drawfilter-code, but it does not change the drawing-behaviour of the button, the arrow is still visible and accessable.
I'm also wondering which part of the filter does influence the arrow drawing. Or is this just a filter example and there is the code missing for hiding the arrow? Can you please give me an example then, how to hide or disable the drowdown-arrow?
Thank you and best regards,
Yes, Boris, I'm all set. Thanks.
Hello desertfoxmb,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.