-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the template to the sample (#1867)
- Loading branch information
1 parent
aa817b5
commit fe4c3d0
Showing
4 changed files
with
117 additions
and
34 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
src/Controls/samples/Controls.Sample/Pages/Others/TemplatePage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Pages.TemplatePage" | ||
BackgroundColor="{DynamicResource PageBackgroundColor}"> | ||
|
||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<Color x:Key="PageBackgroundColor">#512bdf</Color> | ||
<Color x:Key="PrimaryTextColor">White</Color> | ||
|
||
<Style TargetType="Label"> | ||
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> | ||
<Setter Property="FontFamily" Value="OpenSansRegular" /> | ||
</Style> | ||
|
||
<Style TargetType="Button"> | ||
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> | ||
<Setter Property="FontFamily" Value="OpenSansRegular" /> | ||
<Setter Property="BackgroundColor" Value="#2b0b98" /> | ||
<Setter Property="Padding" Value="14,10" /> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
|
||
<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}"> | ||
<Grid RowSpacing="25" RowDefinitions="Auto,Auto,Auto,Auto,*"> | ||
|
||
<Label Text="Hello, World!" | ||
Grid.Row="0" | ||
SemanticProperties.HeadingLevel="Level1" | ||
FontSize="32" | ||
HorizontalOptions="CenterAndExpand" /> | ||
|
||
<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="Current count: 0" | ||
Grid.Row="2" | ||
SemanticProperties.Hint="Counts the number of times you click" | ||
FontSize="18" | ||
FontAttributes="Bold" | ||
x:Name="CounterLabel" | ||
HorizontalOptions="Center" /> | ||
|
||
<Button Text="Click me" | ||
Grid.Row="3" | ||
SemanticProperties.Hint="Counts the number of times you click" | ||
Clicked="OnCounterClicked" | ||
HorizontalOptions="Center" /> | ||
|
||
<Image Grid.Row="4" | ||
Source="dotnet_bot.png" | ||
SemanticProperties.Description="Cute dotnet bot waving hi to you!" | ||
WidthRequest="300" | ||
HeightRequest="372" | ||
HorizontalOptions="Center" /> | ||
|
||
</Grid> | ||
</ScrollView> | ||
</ContentPage> |
19 changes: 19 additions & 0 deletions
19
src/Controls/samples/Controls.Sample/Pages/Others/TemplatePage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
|
||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
public partial class TemplatePage | ||
{ | ||
public TemplatePage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
int count = 0; | ||
private void OnCounterClicked(object sender, EventArgs e) | ||
{ | ||
count++; | ||
CounterLabel.Text = $"Current count: {count}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters