UPDATE : I made a new test project from scratch and this one DID apply the style inside the default platform marker on my mainform on windows and android, so the behaviour seen below might have something todo with rest of my project..I will do some more testing.( I have 1 style ‘backgroundstyle’ with rectangle brush fill color set to red )
UPDATE 2 : As soon as I added 1 specific style for e.g. android platform, none of the ‘default’ platform styles are considered anymore. Mainform suddenly not red anymore.
In an heroic attempt to make a good styling design for my proof of concept multi-platform application, I’m was investigating the stylebook more closely.
In general, separating the styling from the application logic is of course, very welcome. Although I’m more unsure if the fmx implementation of this principle is, sofar, optimal ( I’m losing myself in finding out which property of which styleresource I need to change to get what I want for anything beyond simple text or rectangles….but that might be up to me. ).
I also understand that each target platform has it’s own habits , and it’s good practice to stick to them ( at least, if you want to be part of the hurd 🙂 . But I would say that , e.g. my main application colors is something that I decide, and should be consistent across platforms. It seems that in order to achieve that, I need to change that, possibly , on all the multiple individual style –resources– ( everywhere a fill color is / might be specified in each of the 190 styles in the list and also in all the bitmaps in the bitmap map, and this for each scale and each sourcelinkname.. ) and , again, this for every target platform…The result is usually that I stick to the ‘premium’ out of the box styles 🙂
I had hoped that the ‘default’ platform marker would come to the rescue, and have this platform for all of the styles, and BY EXCEPTION, have only some platform specific styles repeated and changed, if really required on that platform. The documentation says :
Note: There is also the “Default” platform marker. FireMonkey application loads > the Default style when the application cannot find the matching styles for the > current platform.
But it doesn’t seem to work this way. e.g. on android these default styles ( in runtime ) are always ignored and revert to the embedded platform specific style but in windows the styles are indeed used… ( in the IDE at design time, the same default style is shown as I expect for every platform that I choose — ) In my example, I simply use the mainform background color ( = backgroundstyle brush fill color ) as an easy test setup : change the brush fill color on the ‘backgroundstyle’
for the default platform and run it on windows / android ).
So what is the purpose of the default platform in the stylebook ? Is there something I do not understand ? Or is it a bug ? Is there a way to use one set of styles across platform via the stylebook ?
If not, could you create and deploy a single style file and load at runtime and have it used on all platforms ?
( should there be a platform marker in this style file ? Would the styles be ignored if not ‘really’ the correct target platform …)
As a result, I find myself doing a lot of runtime styling in code afterall because I’m really sure it will be platform consistent, but that’s not really the purpose I guess….