Skip to content

Commit

Permalink
Fix template display issues with vertical stack layout
Browse files Browse the repository at this point in the history
- Fix display of image
- Fix number cut off for >=10
  • Loading branch information
melissahoughton committed Jun 24, 2021
1 parent b246dda commit 969e1b9
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions GettingStartedMaui/GettingStartedMaui/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,36 @@
BackgroundColor="{DynamicResource PageBackgroundColor}">

<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
<StackLayout>
<Grid RowSpacing="25" RowDefinitions="Auto,Auto,Auto,Auto,*">

<Label Text="Hello, World!"
Grid.Row="0"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="CenterAndExpand" />
<VerticalStackLayout Spacing="20">

<Label Text="Welcome to .NET Multi-platform App UI"
Grid.Row="1"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="16"
HorizontalOptions="CenterAndExpand" />
<Label Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="CenterAndExpand" />

<Label Text="Current count: 0"
Grid.Row="2"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />
<Label Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="16"
HorizontalOptions="Center" />

<Button Text="Click me"
Grid.Row="3"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
<Label Text="Current count: 0"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />

<Image Grid.Row="4"
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dotnet bot waving hi to you!"
WidthRequest="300"
HorizontalOptions="Center" />
<Button Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />

</Grid>
</StackLayout>
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dotnet bot waving hi to you!"
WidthRequest="300"
HorizontalOptions="Center" />

</VerticalStackLayout>
</ScrollView>
</ContentPage>

2 comments on commit 969e1b9

@TerryTyson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both VS 2019 (16.11.0 Preview 3.0) and VS 2022 (17.0.0 Preview 2.1) I got this error when trying to use VerticalStackLayout:

Property 'Children' does now support values of type 'Label'.

Sticking with StackLayout and removing the Grid worked. (Also added Spacing = "20" as sown above.)

@TerryTyson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also discovered that simply using the Grid without the ScrollView fixes the problem with only showing single digits.

Please sign in to comment.