unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.08k stars 736 forks source link

Ability to specify multiple platforms with Platform-specific XAML #12199

Open morning4coffe-dev opened 1 year ago

morning4coffe-dev commented 1 year ago

What would you like to be added:

A nice to have would be the ability to specify multiple platforms when using Platform-specific XAML. For example:

<android&ios:TextBlock/>

or

<mobile:TextBlock/>

Currently the only way to do this is to have two TextBlocks with the same values or to use some of the existing prefixes which doesn't cover every case.

Why is this needed:

To be able to better specify on which platforms should the control be shown.

For which Platform:

morning4coffe-dev commented 1 year ago

CC @MartinZikmund

Youssef1313 commented 1 year ago

@morning4coffe-dev You can define your own namespace in csproj. We can definitely include more namespace by default.

morning4coffe-dev commented 1 year ago

@Youssef1313 It would be nice to have more, but I did not know that. Thanks!

agneszitte commented 1 year ago

@morning4coffe-dev You can define your own namespace in csproj. We can definitely include more namespace by default.

I agree! (cc @jeromelaban, @Xiaoy312, @kazo0)

Xiaoy312 commented 1 year ago

android&ios is likely gonna be an illegal xmlns, but you can go with AndroidOrIos or mobile

you can define your own specific xmlns that targets a or multiple specific platform(s), using the IncludeXamlNamespaces/ExcludeXamlNamespaces which ive explained here: https://github.com/unoplatform/uno/discussions/12009#discussioncomment-5652568

GitHub
Platform-specific XAML - is the current documentation up-to-date for the new solution type? · unoplatform/uno · Discussion #12009
Does the Platform-specific XAML markup in Uno article reflect the prefixes that can/should be used for the new solution style? For example, should the documentation include mobile and not_mobile: x...