How to change the color in RadDropDownList and RadSpinEditro?

3 Answers 38 Views
DropDownList SpinEditor
Kevin
Top achievements
Rank 2
Iron
Iron
Kevin asked on 23 Jul 2024, 01:22 AM

1.RadDropDownList:

  • How can I change the color of the RadDropDownListArrowButtonElement when the mouse triggers the radDropDownList control? I have not been able to find a way to modify this color.I try my best to solve it ,but it works not well.

  • How can I change the color of the dropdown content when the mouse hovers over it? I have also not been able to find a way to modify this color.

  • How can I remove the white shadow under the downward triangle? I want it to be entirely black without any white shadow.

2.RadSpinEditor:

When I use RadSpinEditor, I have the same questions in it.

  • How can I change the color of the dropdown content when the mouse hovers over it?

  • How can I remove the white shadow under the downward triangle?

 

 

Kevin
Top achievements
Rank 2
Iron
Iron
commented on 23 Jul 2024, 07:18 AM

I have created a Telerik RadMenu control and found that it has the same issue as the RadDropDownList and RadSpinEditor controls. When the mouse hovers over it, it displays the same color as the other controls. Can this be modified uniformly? Thank you.

3 Answers, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 25 Jul 2024, 09:15 AM

Hello, Kevin,

Reading through your posts it seems that you need help with RadDropDownList:

To change the color of selected item in the drop down you can use the VisualListItemFormatting event: Formatting Items - RadDropDownList - Telerik UI for WinForms

void radDropDownList1_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
    if (args.VisualItem.Selected )
    {
        args.VisualItem.DrawFill = true;
        args.VisualItem.BackColor = Color.DarkBlue;
        args.VisualItem.GradientStyle = GradientStyles.Solid;
    }
    else
    {
        args.VisualItem.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
        args.VisualItem.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        args.VisualItem.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
    }
}

Here you can find also useful information about how to access and customize elements: Accessing and Customizing Elements - RadDropDownList - Telerik UI for WinForms

The following code snippet demonstrates how to access the arrow button element and change its color:

this.radDropDownList1.DropDownListElement.ArrowButton.Fill.BackColor = Color.Aqua;

I hope this information helps. If you have any further questions, please let me know. 

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.

0
Kevin
Top achievements
Rank 2
Iron
Iron
answered on 24 Jul 2024, 10:59 AM
About the question:
  • How can I remove the white shadow under the downward triangle? I want it to be entirely black without any white shadow.

I find the solution in white_shadow.png. But I don't know whether I solve it correctly.

About the question:

  • How can I change the color of the dropdown content when the mouse hovers over it?

I advise the website to slove it, but not completely solve.
https://www.telerik.com/forums/change-dropdownlist-item-color
https://www.telerik.com/forums/how-do-i-change-the-background-color-of-the-dropdown-portion-of-a-raddropdownlist

Please help me this question:

  • How can I change the color of the RadDropDownListArrowButtonElement and RadMenu when the mouse triggers the radDropDownList control and RadMenu control?

I can't find a way to change the control color when the mouse triggers on it.

 

Kevin
Top achievements
Rank 2
Iron
Iron
commented on 24 Jul 2024, 11:00 AM

the white_shadow.png
0
Kevin
Top achievements
Rank 2
Iron
Iron
answered on 25 Jul 2024, 01:28 AM


        private void ShapedForm1_Load(object sender, EventArgs e)
        {
            foreach (RadMenuItem item in radMenu1.Items)
            {
                AddHoverEffect(item);
            }
        }
        private void AddHoverEffect(RadMenuItem item)
        {
            item.MouseEnter += RadMenuItem_MouseEnter;
            item.MouseLeave += RadMenuItem_MouseLeave;

            foreach (RadMenuItem childItem in item.Items)
            {
                AddHoverEffect(childItem);
            }
        }

        private void RadMenuItem_MouseEnter(object sender, EventArgs e)
        {
            RadMenuItem item = sender as RadMenuItem;
            item.FillPrimitive.BackColor = Color.Blue;
        }

        private void RadMenuItem_MouseLeave(object sender, EventArgs e)
        {
            RadMenuItem menuItem = sender as RadMenuItem;
            menuItem.FillPrimitive.BackColor = Color.Green;
        }
I have solved the problem about RadMenu.But I also need help to solve the RadDropDownList.
Tags
DropDownList SpinEditor
Asked by
Kevin
Top achievements
Rank 2
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Kevin
Top achievements
Rank 2
Iron
Iron
Share this question
or