Is there any way of changing the background color on a RadDropDownButton when IsOpen = true, without needing to update the template?
2 Answers, 1 is accepted
0
Martin Ivanov
Telerik team
answered on 09 Jan 2019, 06:32 AM
Hello KWUN WA,
There is no API that allows you to easily change the background of the button when the dropdown is opened. However, if you don't want to extract the template of the button you can use the visual tree helper methods to get the corresponding visual element and set its Background. Here is an example in code:
var checkedVisual = btn.ChildrenOfType<Border>().FirstOrDefault(x => x.Name == "CheckedVisual");
if (checkedVisual != null)
{
checkedVisual.Background = Brushes.Green;
}
}
Note that the Name of the visual might differ across the different Telerik themes. This is why if this doesn't work please peek in the corresponding template and see which element exactly you need.
Also, the Material, Fluent and Crystal themes expose an attached properties (in the MaterialAssist class) that you can use in order to modify the backgrounds of the controls in the different states. You can read more about this in the corresponding theme article.
Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.