Hi, Thank Nadya, but this solution is so difficult! i fix it with this solution:
Step 1:
create 2 ImageList, set named "light" and "dark". get icon with "white" and "Black" colored with "Same Name" (like screenshot).
Step 2:
for all component that i'm used, set "imagelist" and "imagekey" to show suitable icon in my control
Step 3:
specially i'm use a "toggleswitch" to change Theme ("Fluent" and "FluentDark")
see code:
01.
public
IEnumerable<Control> GetAll(Control control, Type type)
02.
{
03.
var controls = control.Controls.Cast<Control>();
04.
05.
return
controls.SelectMany(ctrl => GetAll(ctrl, type))
06.
.Concat(controls)
07.
.Where(c => c.GetType() == type);
08.
}
09.
private
void
themeswitcher_ValueChanged(
object
sender, EventArgs e)
10.
{
11.
12.
if
(themeswitcher.Value)
13.
{
14.
var btnlist = GetAll(
this
,
typeof
(RadButton));
15.
foreach
(RadButton c
in
btnlist)
16.
{
17.
c.ImageList = light;
18.
}
19.
}
20.
else
21.
{
22.
var btnlist = GetAll(
this
,
typeof
(RadButton));
23.
foreach
(RadButton c
in
btnlist)
24.
{
25.
c.ImageList = dark;
26.
}
27.
}
28.
ThemeResolutionService.ApplicationThemeName = !themeswitcher.Value ?
"FluentDark"
:
"Fluent"
;
29.
30.
}
line 1 to 18, create the method to GetAll controls thats we need change!
line 19 to 30, change theme and image/icon with switch between 2 ImageList thats we created.
i hope this solution is better and easier!
again, thanks Telerik admins