Completed
Last Updated: 14 Jan 2025 13:51 by ADMIN
Release 2025.1.2xxx (2025 Q1)
Jorge Javier
Created on: 07 Jan 2025 12:53
Category: Buttons
Type: Bug Report
0
RadDropDownButton: Update RadDropDownButton's child elements in docs

We are using the DropDownButtonElement on a RibbonBar, there are a very frustating issue with the RadArrowButtonElement.

WinForms RadButtons RadDropDownButton's elements hierarchy

 

On this image it show 5 children, but on code there are 6 children, here is a CopyPase of your  CreateChildElements in RadArrowButtonElement.


    protected override void CreateChildElements()
    {
        arrow = new ArrowPrimitive(ArrowDirection.Down);
        arrow.Class = "RadArrowButtonArrow";
        arrow.AutoSize = false;
        arrow.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
        overflowArrow = new OverflowPrimitive(ArrowDirection.Down);
        overflowArrow.Class = "RadArrowButtonOverflowArrow";
        overflowArrow.AutoSize = false;
        overflowArrow.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
        overflowArrow.Visibility = ElementVisibility.Collapsed;
        fillPrimitive = new FillPrimitive();
        fillPrimitive.Class = "RadArrowButtonFill";
        fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
        borderPrimitive = new BorderPrimitive();
        borderPrimitive.Class = "RadArrowButtonBorder";
        borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
        imagePrimitive = new ImagePrimitive();
        imagePrimitive.Class = "RadArrowButtonImage";
        imagePrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
        imagePrimitive.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
        textPrimitive = new TextPrimitive();
        textPrimitive.Class = "RadArrowButtonTextGlyph";
        textPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
        textPrimitive.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
        textPrimitive.StretchHorizontally = true;
        textPrimitive.StretchVertically = true;
        Children.Add(fillPrimitive);
        Children.Add(borderPrimitive);
        Children.Add(arrow);
        Children.Add(overflowArrow);
        Children.Add(imagePrimitive);
        Children.Add(textPrimitive);
    }


The problem is that we are changing the ArrowButton size to (6, 0) width, here is the how it looks:

As you can see the triangle is outside the ArrowButton, my first idea was to look the ArrowPrimitive and OverflowPrimitive, but that triangle is on TextPrimitive.

Making this change on RadDropDownButtonElement i was able to "solve" the offset and the size.
base.ArrowButton.TextPrimitive.Font = new Font(base.ArrowButton.TextPrimitive.Font.FontFamily, 6);

I have to comment this to something like: "I dont know why this works, but the triangle is on a child text primitive... So don't erase this line".

3 comments
ADMIN
Nadya | Tech Support Engineer
Posted on: 08 Jan 2025 14:24

Hello, Jorge Javier,

Note, the font which is used here is TelerikWebUI. Keep in mind that themes are applied at a later stage when initializing the controls. If you need to set the font in a similar way that you show in the code snippet, I would recommend you to set the Font in the form's Shown/Load event, right before the button is about to be shown:

protected override void OnShown(EventArgs e)
{
    base.OnShown(e);
    this.radDropDownButton1.DropDownButtonElement.ArrowButton.TextPrimitive.Font = new Font(this.radDropDownButton1.DropDownButtonElement.ArrowButton.TextPrimitive.Font.FontFamily, 6);

}

Alternatively, you can use the TelerikWebUI font directly. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jorge Javier
Posted on: 08 Jan 2025 13:35
 

The problem is that using a specific configuration it is displayed like this.

  
ADMIN
Nadya | Tech Support Engineer
Posted on: 07 Jan 2025 15:15

Hello, Jorge Javier,

Thank you for writing. 

I confirm that the image showing the child elements of RadDropDownButtonElement should be updated in our documentation. The TextPrimitive is missing. I approved this bug report. Below you can see the correct image showing the structure. 

I updated your Telerik Points for bringing this to our attention. 

As to the behavior that you described, I would like to note that some of our newest themes (such as VisualStudio2022Dark theme) use a glyph to display the arrow icon in the DropDownButton. This is why it is suitable to set the Font on TextPrimitive to manage the size of the arrow. The approach that you follow is correct.

I hope this information is useful. Should you have any other questions do not hesitate to contact me.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.