Skip to content

Commit c58a77b

Browse files
committed
re-create sandbox app
1 parent d457655 commit c58a77b

36 files changed

+626
-440
lines changed

sandbox/SandboxMAUI/App.xaml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
23
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
34
xmlns:local="clr-namespace:SandboxMAUI"
45
x:Class="SandboxMAUI.App">
56
<Application.Resources>
67
<ResourceDictionary>
7-
8-
<Color x:Key="PrimaryColor">#512bdf</Color>
9-
<Color x:Key="SecondaryColor">White</Color>
10-
11-
<Style TargetType="Label">
12-
<Setter Property="TextColor" Value="{DynamicResource PrimaryColor}" />
13-
<Setter Property="FontFamily" Value="OpenSansRegular" />
14-
</Style>
15-
16-
<Style TargetType="Button">
17-
<Setter Property="TextColor" Value="{DynamicResource SecondaryColor}" />
18-
<Setter Property="FontFamily" Value="OpenSansRegular" />
19-
<Setter Property="BackgroundColor" Value="{DynamicResource PrimaryColor}" />
20-
<Setter Property="Padding" Value="14,10" />
21-
</Style>
22-
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
2312
</ResourceDictionary>
2413
</Application.Resources>
2514
</Application>

sandbox/SandboxMAUI/App.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
public partial class App : Application
44
{
5-
public App()
6-
{
7-
InitializeComponent();
5+
public App()
6+
{
7+
InitializeComponent();
88

9-
MainPage = new NavigationPage(new MainPage());
10-
}
9+
MainPage = new AppShell();
10+
}
1111
}

sandbox/SandboxMAUI/AppShell.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="SandboxMAUI.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:SandboxMAUI"
7+
Shell.FlyoutBehavior="Disabled">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace SandboxMAUI;
2+
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}

sandbox/SandboxMAUI/MainPage.xaml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1-
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
23
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
3-
x:Class="SandboxMAUI.MainPage"
4-
xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit"
5-
BackgroundColor="{DynamicResource SecondaryColor}">
6-
4+
x:Class="SandboxMAUI.MainPage">
5+
76
<ScrollView>
8-
<StackLayout
9-
Padding="{OnPlatform iOS='30,60,30,30', Default='30'}" Spacing="10">
10-
11-
12-
<Button Text="CheckBox" Clicked="GoToCheckBoxPage" />
7+
<VerticalStackLayout
8+
Spacing="25"
9+
Padding="30,0"
10+
VerticalOptions="Center">
1311

14-
<Button Text="Radio Button" Clicked="GoToRadioButtonPage" />
12+
<Image
13+
Source="dotnet_bot.png"
14+
SemanticProperties.Description="Cute dot net bot waving hi to you!"
15+
HeightRequest="200"
16+
HorizontalOptions="Center" />
17+
18+
<Label
19+
Text="Hello, World!"
20+
SemanticProperties.HeadingLevel="Level1"
21+
FontSize="32"
22+
HorizontalOptions="Center" />
23+
24+
<Label
25+
Text="Welcome to .NET Multi-platform App UI"
26+
SemanticProperties.HeadingLevel="Level2"
27+
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
28+
FontSize="18"
29+
HorizontalOptions="Center" />
1530

16-
<Button Text="Advanced Entry &amp; FormView" Clicked="GoToAdvancedEntryPage" />
17-
<Button Text="Advanced Slider" Clicked="GoToAdvancedSliderPage" />
31+
<Button
32+
x:Name="CounterBtn"
33+
Text="Click me"
34+
SemanticProperties.Hint="Counts the number of times you click"
35+
Clicked="OnCounterClicked"
36+
HorizontalOptions="Center" />
1837

19-
</StackLayout>
38+
</VerticalStackLayout>
2039
</ScrollView>
40+
2141
</ContentPage>
Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
1-
using SandboxMAUI.Pages;
1+
namespace SandboxMAUI;
22

3-
namespace SandboxMAUI
3+
public partial class MainPage : ContentPage
44
{
5-
public partial class MainPage : ContentPage
6-
{
7-
public MainPage()
8-
{
9-
InitializeComponent();
10-
}
5+
int count = 0;
116

12-
async void GoToCheckBoxPage(System.Object sender, System.EventArgs e)
13-
{
14-
await Navigation.PushAsync(new CheckBoxPage());
15-
}
7+
public MainPage()
8+
{
9+
InitializeComponent();
10+
}
1611

17-
async void GoToRadioButtonPage(System.Object sender, System.EventArgs e)
18-
{
19-
await Navigation.PushAsync(new RadioButtonPage());
20-
}
12+
private void OnCounterClicked(object sender, EventArgs e)
13+
{
14+
count++;
2115

22-
async void GoToAdvancedEntryPage(System.Object sender, System.EventArgs e)
23-
{
24-
await Navigation.PushAsync(new AdvancedEntryPage());
25-
}
16+
if (count == 1)
17+
CounterBtn.Text = $"Clicked {count} time";
18+
else
19+
CounterBtn.Text = $"Clicked {count} times";
2620

27-
async void GoToAdvancedSliderPage(System.Object sender, System.EventArgs e)
28-
{
29-
await Navigation.PushAsync(new AdvancedSliderPage());
30-
}
31-
}
21+
SemanticScreenReader.Announce(CounterBtn.Text);
22+
}
3223
}
24+

sandbox/SandboxMAUI/MauiProgram.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using InputKit.Handlers;
2-
3-
namespace SandboxMAUI;
1+
namespace SandboxMAUI;
42

53
public static class MauiProgram
64
{
@@ -12,13 +10,9 @@ public static MauiApp CreateMauiApp()
1210
.ConfigureFonts(fonts =>
1311
{
1412
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
13+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
1514
});
1615

17-
builder.ConfigureMauiHandlers(handlers =>
18-
{
19-
handlers.AddInputKitHandlers();
20-
});
21-
2216
return builder.Build();
2317
}
2418
}

sandbox/SandboxMAUI/Pages/AdvancedEntryPage.xaml

Lines changed: 0 additions & 80 deletions
This file was deleted.

sandbox/SandboxMAUI/Pages/AdvancedEntryPage.xaml.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

sandbox/SandboxMAUI/Pages/AdvancedSliderPage.xaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)