Read-Only Access on Theme File

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Hi,

Is it possible have a read-only access on current theme file being used by an app to get some values like fonts, height and width?

Thanks.

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

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

 

  • You must to post comments
Showing 3 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json