Sounds like a smart thing to do, and fuse documentation seems to encourage this here and there. E.g. the “Resources” tutorial. However, I have never seen a complete example, and I’ve been wondering a lot how to do it.
Let’s say I want to:
Base my look-and-feel on the BasicTheme with Red color scheme
Define a few more color-resources in addition to the C50-C1000 different reds. In particular, i want to define a few greys
Define some classes for menu buttons and other controls with customized styling.
include some fonts with names that I can refer to later
How to do this?
Which type should the root node of my look-and-feel file be? Style? Theme? Node? I tried using Node, but I get “There is no identifier named ‘__parent’ in this scope”
Should I define colors using SolidColor and ux:Name ? OR should i define resources, after all that’s how the Cxxx-colors are defined. Or should I use ux:Class and instantiate them where I need them?
I’d like to define a “separator” element, which is simply a grey line that I can use to separate up my gui elemens in the view. What base class should I use? I tried Panel and Rectangle, but I get “Cannot use sealed class for base class”
Here’s what I’m experimenting with at the moment. I know that it doesn’t include all of the above. I just haven’t understood what I’m doing:
Resources with different types can have different names. The resources are resolved based on both type and key.
Define some classes for menu buttons and other controls with customized styling.
This is done using ux:Class
<Button ux:Class="MyButton" FontSize="18" />
Note that the UX simulator does currently not support changes to inner classes (this is coming). Whenever you change one of these, you have to do a hard recompile.
Once you have a custom class, you can either style it directly on the class, or in a style tag:
Hi Anders, thanks for the examples, but I’ve seen all of those in your various tutorials. The main point of my question was a little on the side of this.
How can I collect all my look-and-feel code in one file? (Or if not possible, what is the recommended way to encapsulate your “look-and-feel”)
I want to put my color definitions in a separate file, but each type must contain only one root node - what type shoud i use if I want to instantiate this directly in my App?
I’m bumping this because I want to do the same but when I call TextColor="{Resource someColor}" I always get black text. I also tried it as ux:Global to no success.