I'm creating a list of RadToggleButtons on runtime dinamically, an then I add some events to change their appeareance:
private void bottonDevice_MouseEnter(object sender, EventArgs e)
{
RadToggleButton button = (RadToggleButton)sender;
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(206)))), ((int)(((byte)(117)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(196)))), ((int)(((byte)(52)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(220)))), ((int)(((byte)(158)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(232)))), ((int)(((byte)(180)))));
}
The Event MouseEnter changes the Togglebutton background successfully, so the MouseLeave Event too. But the ToggleStateChanged Event simply doesn't work :( here's the Event code.
private
void buttonDevice_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
{
// ToggleChange(btnView);
RadToggleButton button = (RadToggleButton)sender;
ToggleChange(button);
if (args.ToggleState == ToggleState.On)
{
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(167)))), ((int)(((byte)(77)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(146)))), ((int)(((byte)(0)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(204)))), ((int)(((byte)(116)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(197)))), ((int)(((byte)(136)))));
}
else
{
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(193)))), ((int)(((byte)(193)))), ((int)(((byte)(193)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(151)))), ((int)(((byte)(148)))), ((int)(((byte)(148)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
((Telerik.WinControls.Primitives.
FillPrimitive)(button.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226)))));
}
}
Can you help me with that issue?. I write my code that way because, I've tried to apply a Theme loaded in design time to my controls, but it didn't work either.Thanks