Hi,
I am trying to access a colour within a style resource like so:
public static Color COLOR_ONE;
public static Appearance APPEARANCE_ONE = new Appearance();
static Constant ()
{
APPEARANCE_ONE.StyleResourceName = "ResourceOne";
COLOR_ONE = APPEARANCE_ONE.BackColor;
}
So I would like COLOR_ONE to be the background colour of ResourceOne.
However the issue here is that the BackColor of APPEARANCE_ONE is still set to the default of 0,0,0,0, presumably because it just ignores this and looks at the StyleResource.
Is there any way to point this directly to the BackColor of the StyleResource?
Thanks very much in advance,
Alastair
Thanks, that helps!
Hi Alastair,
Setting the resource on the appearance doesn't change any properties on the appearance, the colors get resolved when the appearance is used.
So you would have to get the color from the resource itself. There's not a lot of documentation on how to access the styling information in code, but there I've posted a couple of examples with some code that might point you in the right direction.
These don't actually deal with resources, but it should give you a basic idea of where to start accessing information inside the currently-applied style library.
Change font at runtime - Infragistics Forums
Determine Font when using AppStylist - Infragistics Forums