Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive UI Sample(Desktop,Mobile) #53

Open
Sarthak261995 opened this issue Jul 5, 2023 · 3 comments
Open

Responsive UI Sample(Desktop,Mobile) #53

Sarthak261995 opened this issue Jul 5, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@Sarthak261995
Copy link

Topics to cover

Please add sample for Responsive UI for Desktop and Mobile size devices.
Like changing font, height, width of controls as per platform it is running on through Xaml.
Showing fixed side drawer on Desktop while having sliding drawer for Android and iOS.
Changing Grid row and column count as per Platform Desktop, Mobile etc.
Or Load different UserControl based on Platform through Xaml

Ideas for a sample

image

@Sarthak261995 Sarthak261995 added the enhancement New feature or request label Jul 5, 2023
@timunie
Copy link
Collaborator

timunie commented Jul 5, 2023

This request comes on the right time. Today 11.0 dropped, which will make this possible.

Do you whish to work on it? Otherwise I'll leave it open to when I find the time to pick this up.

@Sarthak261995
Copy link
Author

Sarthak261995 commented Jul 5, 2023

Sure, I would love to. But I am kind of new to the Avalonia UI and going through the documentation for now.
Though I have a good experience in MAUI/Xamarin and Flutter
In MAUI we usually use following to achieve responsive UI.
OnIdom
OnPlatform
OnSizeChangedEvent
Grid which I know is available in Avalonia as well.
AppThemBinding for theme changes
Create Different Styles and use OnIdom to apply those in Xaml
e.g

 <Label Style="{OnIdom Phone={StaticResource PhoneStyle} Tablet={StaticResouce TabletStyle}}"

Or we can do something below to load different control based on Platform or Idom

<ContentView.Content>
<OnPlatform x:TypeArguments="View">
<OnPlatform.iOS><control:iOSControl></OnPlatform.iOS>
<OnPlatform.Android><control:AndroidControl></OnPlatform.Android>
</OnPlatform>
</ContentView.Content>

Can you just give me the alternative property name of the above approaches in Avalonia I will figure out the rest. Still figuring out these things

Hopefully I would be able to do this in couple of weeks for sure.

I know I can achieve those through code behind for sure but that would not be for everyone.

Also, Congratulations for v11 Release you guys doing a great job.
v11 which moves Avalonia more towards Android and iOS to become true Cross platform brings me here honestly.

@timunie
Copy link
Collaborator

timunie commented Jul 10, 2023

I have not played around with it on my own yet as my apps are all on Desktop only. I guess your best bet is to explore the samples in the source here: https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/PlatformInfoPage.xaml

the RP that add this: AvaloniaUI/Avalonia#7812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants