MaximumWidthRequest property behaves differently in Windows and Android
See original GitHub issueDescription
Inner Grid has a MaximumWidthRequest of 600, and is placed inside an outer Grid with a blue background.
On Windows it looks as desired:
Shrink the window and it’s still fine:
On Android it is wrong:
Steps to Reproduce
New project.
This goes inside the ContentPage:
<Grid BackgroundColor="Blue">
<Grid MaximumWidthRequest="600" BackgroundColor="White">
<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
<Label
Text="You will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday; and my first task is to assure my dear sister of my welfare, and increasing confidence in the success of my undertaking."
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</Grid>
</Grid>
Version with bug
Release Candidate 3 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12
Did you find any workaround?
Bind MaximumWidthRequest to a view model readonly property that returns Min(600, screenVirtualWidth).
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:9
Top Results From Across the Web
Untitled
SearchBar centering inconsistency on Android with MaximumWidthRequest … ... in xamarin forms MaximumWidthRequest property behaves differently in Windows …
Read more >Build accessible apps with semantic properties - .NET MAUI
On Android, this property behaves slightly differently depending on the control it's attached to. For example, for controls without text ...
Read more >c# - How do I access and change properties of a control ...
1 Answer 1 ... To be honest, you should think clearly about interface design. On mobile, the interface is not large, if you...
Read more >.NET MAUI Tutorial for Beginners - Build iOS, Android, macOS ...
NET MAUI to build apps for iOS, Android, macOS, and Windows. ... https://docs. microsoft.com/learn/paths/build-apps-with-dotnet-maui/?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm this… It’s so annoying to design your app around MAUI bugs instead around your desired goal…
Edit: I see this has been fixed for Button in v8. For a Button, it works on Windows but not Android…