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

Foreground not working on multiple controls

5 Answers 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 21 Jun 2012, 03:51 PM

Hello,

I'm trying to change the foreground on a few different controls - one being a RadTabItem.  However, they are displaying white.  Prior to the last upgrade these were working.  Below is some sample code.

UserRadTabItem = new RadTabItem                 
{                     
    Tag = "tabUsers",                     
    Header = "Users",                     
    IsSelected = true,                     
    Margin = new Thickness(0, 5, 5, 0),                     
    Height = 40,                     
    Width = 60,                     
    FontSize = 13,                     
    Foreground = new SolidColorBrush(Colors.Green),                     
    Cursor = Cursors.Hand,                 
};

Thanks,
Derek

5 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 22 Jun 2012, 04:10 PM
Hi Derek,

Do you have a theme set on the controls?

Lancelot
0
Derek
Top achievements
Rank 1
answered on 22 Jun 2012, 04:12 PM
Yes, metro.

Derek
0
Lancelot
Top achievements
Rank 1
answered on 22 Jun 2012, 04:18 PM
  There is your problem. Once you are using a theme manager, you can't override a particular foreground property. The Style takes precedence. You can however leverage the new implicit theming system of the controls.You have a few options, the quickest way would be to set a certain palette at runtime. Learn how to do that here.

In your situation I would just modify the existing Metro theme. You can do that by following these directions.

I hope I helped clear this up for you, good luck.

Lancelot
0
Derek
Top achievements
Rank 1
answered on 22 Jun 2012, 04:21 PM
Thanks a lot.  Was this changed with the latest upgrade becuase it used to work?  Seems strange you can't override a style at the page level.

Derek
0
Lancelot
Top achievements
Rank 1
answered on 22 Jun 2012, 04:29 PM
Derek,

Yes, the changes made to the theming mechanisms started with Q1 SP1 update and Q2 release. This document describes more about the changes and the new abilities. It gives you much more flexibility throughout your application, you can set a custom theme to just one control or change it at runtime.

This way, instead of having to change all of the attributes of a control in an event handler (each time on each page). You can just set it once to change everything on that particular control. You only have to set the colors once and it will work application-wide where you want it to.

Lancelot
Tags
General Discussions
Asked by
Derek
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Derek
Top achievements
Rank 1
Share this question
or