This is a migrated thread and some comments may be shown as answers.

RadLabel ForeColor still gray after reenabled

4 Answers 157 Views
Label
This is a migrated thread and some comments may be shown as answers.
Chris Ward
Top achievements
Rank 1
Chris Ward asked on 10 Nov 2014, 08:42 PM
When a RadLabel enters the disabled state the fore color changes to gray. However, when the RadLabel is re-enabled the fore color does not return to it's former glory, rather it stays gray forever.

I can't seem to override this behavior even with a custom theme.

Edit: I tried setting the forecolor in radLabel1_EnabledChanged, but it never fired. The problem seems to be that when a RadLabel parent's Enabled flag is set to true, the RadLabel itself is never notified of the event.

If I manually set ".Enabled = true;" for every label on my form, they restore their original ForeColors as expected.

The RadLabel is in a SplitPanel which is in a RadSplitContainer, where the RadSplitContainer is the control being disabled / enabled.

4 Answers, 1 is accepted

Sort by
0
Chris Ward
Top achievements
Rank 1
answered on 10 Nov 2014, 08:45 PM
I was almost certain I had reported this bug in the past (2 years ago), but I couldn't find the post. Here it is:
http://www.telerik.com/forums/radlabel-style-bug#xrvUzMPkQEGNPDhKcb4IdQ

Contrary to what was suggested there, this issue has not been resolved in the latest version as far as I can tell.
0
George
Telerik team
answered on 13 Nov 2014, 02:48 PM
Hello Chris,

Thank you for writing.

I was not able to reproduce the scenario you are describing on my end. You can find my sample project attached below. It is setup by your instructions. Please, take a look at it and let me know if there is anything that I am missing.

Looking forward to your reply.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Chris Ward
Top achievements
Rank 1
answered on 13 Nov 2014, 05:54 PM
Hmm, so it appears this is actually a theme issue.

If I use a theme, i.e. VisualStudio2012Light, then any ForeColor I set in the designer is overridden by the theme's RadLabelElement.ForeColor. In an attempt to fix this, I unset the ForeColor from "Black" in Visual Style Builder to allow it to overridden (I need some red labels in my form). Since, however, RadLabelElement.Disabled explicitly sets the ForeColor to "DisabledForeColor", when it is reenabled the ForeColor never goes back to black.

To resolve this, I set RadLabelElement back to "Black" in the theme, and disabled theming on the labels I needed to be red.

If there's a better solution, I'm all ears. In any case, thank you for your help.
0
George
Telerik team
answered on 14 Nov 2014, 02:30 PM
Hi Chris,

Thank you for writing back.

In order to keep the labels red in all cases you can use the following code:
radLabel.Text = "Red Label";
radLabel.RootElement.UseCompatibleTextRendering = false;
radLabel.RootElement.UseDefaultDisabledPaint = false;
radLabel.LabelElement.ForeColor = Color.Red;
radLabel.LabelElement.RadPropertyChanged += LabelFill_RadPropertyChanged;
....
void LabelFill_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
{
    if (e.Property.Name == "Enabled")
    {
        radLabel.LabelElement.ForeColor = Color.Red;
    }
}

I hope this will help.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Label
Asked by
Chris Ward
Top achievements
Rank 1
Answers by
Chris Ward
Top achievements
Rank 1
George
Telerik team
Share this question
or