It’s already available using
Application.Theme see the definition of the ClientTheme class.
You can read just about any value from the theme and resolve the indirections (colors, fonts and images):
// Read the height of the caption bar. var titleHeight = Application.Theme.GetProperty<int>("window/captionbar", "height"); // Translate a color. var color = Application.Theme.GetColor("windowText"); // Read and translate the button's hovered back color. var color = Application.Theme.GetColor("button", "textColor", "pressed");
Notice that the appearance path requires a forward slash.
The last optional argument is the state name. The default is “default”. The states are mixed, so if you read “hovered” if you get the values inherited from “default” and overridden or added by “hovered”.
I noticed a problem though with the public GetColor(), GetFont() and GetImage(), they only read from properties and not from styles. If you need to read a style value for now use GetStyle() and the resolve it using GetColor(), Font, Image. And also the public GetImage() always returns null. That’s WJ-7568.
If it worked, GetImage() returns an actual System.Drawing.Image from the url or the base64 png or gif – but NOT from the svg images. The svg renderer is plugged in only at design time.
Best,,
Luca
Hi Cris,
there is a problem in the public interface to the theme that will be fixed in the next build.
We´ll keep you updated.
Best regards
Frank
Hi Luca,
This is very informative. I can now access values/settings from the theme file. GetFont() is not available though. Am I missing something?
Thanks.