Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upEnhance documentation on how to use native control styles #3649
Comments
Agreed this an important Uno feature. There's a starting point here https://github.com/unoplatform/uno/blob/master/doc/articles/using-uno-ui.md#using-styles addressing Uno 3.0+ support for native styles.
|
Excellent! From the referenced documentation I'm not quite sure whether I will be able to render UWP style for particular pages only, or even for particular elements only. This is my use case: In general, I would prefer to render native controls throughout my app. For one, I presume they will be rendered faster; and for two, the user is acquainted to this controls style and will prefer this style. Then, there may be a "sophisticated" page in my app where I want all controls to adhere to my fancy custom UWP style. Or there may be only a single grid in a page where I want my fancy styles to apply. Can this be done, too? Is there something like a style attribute or style element I can add to XAML elements to switch mode? Something like this: <NativePresenterArea>
<ToggleSwitch />
</NativePresenterArea>
<!-- or -->
<UwpPresenterArea>
<ToggleSwitch />
</UwpPresenterArea>
<!-- or -->
<NativePresenterArea Mode="Native">
<ToggleSwitch />
</NativePresenterArea>
<NativePresenterArea Mode="UWP">
<ToggleSwitch />
</NativePresenterArea> Is this the Perhaps my question is stupid. I'm new to UWP, please forgive my ignorance if it is. |
This is actually straightforward to do for single elements. You can assign a <NativePresenterArea>
<ToggleSwitch not_win:Style="{StaticResource NativeDefaultToggleSwitch}"/>
</NativePresenterArea>
<!-- or -->
<UwpPresenterArea>
<ToggleSwitch not_win:Style="{StaticResource XamlDefaultToggleSwitch}"/>
</UwpPresenterArea> See here for an explanation of the There's no out-of-the-box way to say 'all controls within this page should have UWP/native styling' at the moment. |
Fascinating! Thanks a lot for this very helpful information! Would you suggest to keep this issue open as a reminder for adding your valuable information to the FAQ? Or should this issue rather be closed? |
Let's keep it open, it's a valid documentation request and the info does belong in the docs, not just in an issue comment ;) |
@davidjohnoliver For now the info could be added under articles into a new howto file right ? |
@agneszitte-nventive Indeed :) Something like Note for contributors: As mentioned in an earlier comment, expanding the material here would be a good basis. There are also a couple more configuration methods added recently which can be documented. |
What would you like clarification on:
I read that Uno renders all controls in Windows style and there is an option somewhere deep in Uno to have some of the controls render in native OS style.
I believe it's crucial to be able to switch an application's (or page's) property to render controls using native styles wherever applicable (and to be able to switch back to Windows style again whenever felt necessary).
Can you please prominently describe how to switch between native rendering and Windows style rendering in the FAQ and the documentation?
Concern?
For which Platform: