Skip to content

Commit 575506f

Browse files
committed
Re-add Demo Content
1 parent 9c885e5 commit 575506f

18 files changed

+326
-50
lines changed

sandbox/SandboxMAUI/MainPage.xaml

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,20 @@
22
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="SandboxMAUI.MainPage">
5-
5+
66
<ScrollView>
7-
<VerticalStackLayout
8-
Spacing="25"
9-
Padding="30,0"
10-
VerticalOptions="Center">
7+
<StackLayout
8+
Padding="{OnPlatform iOS='30,60,30,30', Default='30'}" Spacing="10">
119

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" />
10+
<Button Text="CheckBox" Clicked="GoToCheckBoxPage" />
3011

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" />
12+
<Button Text="Radio Button" Clicked="GoToRadioButtonPage" />
3713

38-
</VerticalStackLayout>
14+
<Button Text="Advanced Entry &amp; FormView" Clicked="GoToAdvancedEntryPage" />
15+
16+
<Button Text="Advanced Slider" Clicked="GoToAdvancedSliderPage" />
17+
18+
</StackLayout>
3919
</ScrollView>
40-
20+
4121
</ContentPage>
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
namespace SandboxMAUI;
1+
using SandboxMAUI.Pages;
2+
3+
namespace SandboxMAUI;
24

35
public partial class MainPage : ContentPage
46
{
5-
int count = 0;
6-
7-
public MainPage()
8-
{
9-
InitializeComponent();
10-
}
11-
12-
private void OnCounterClicked(object sender, EventArgs e)
13-
{
14-
count++;
7+
public MainPage()
8+
{
9+
InitializeComponent();
10+
}
11+
async void GoToCheckBoxPage(System.Object sender, System.EventArgs e)
12+
{
13+
await Navigation.PushAsync(new CheckBoxPage());
14+
}
1515

16-
if (count == 1)
17-
CounterBtn.Text = $"Clicked {count} time";
18-
else
19-
CounterBtn.Text = $"Clicked {count} times";
16+
async void GoToRadioButtonPage(System.Object sender, System.EventArgs e)
17+
{
18+
await Navigation.PushAsync(new RadioButtonPage());
19+
}
2020

21-
SemanticScreenReader.Announce(CounterBtn.Text);
22-
}
23-
}
21+
async void GoToAdvancedEntryPage(System.Object sender, System.EventArgs e)
22+
{
23+
await Navigation.PushAsync(new AdvancedEntryPage());
24+
}
2425

26+
async void GoToAdvancedSliderPage(System.Object sender, System.EventArgs e)
27+
{
28+
await Navigation.PushAsync(new AdvancedSliderPage());
29+
}
30+
}

sandbox/SandboxMAUI/MauiProgram.cs

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

35
public static class MauiProgram
46
{
@@ -13,6 +15,11 @@ public static MauiApp CreateMauiApp()
1315
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
1416
});
1517

18+
builder.ConfigureMauiHandlers(handlers =>
19+
{
20+
handlers.AddInputKitHandlers();
21+
});
22+
1623
return builder.Build();
1724
}
1825
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"
5+
xmlns:vm="clr-namespace:SandboxMAUI.ViewModels"
6+
x:Class="SandboxMAUI.Pages.AdvancedEntryPage"
7+
Title="AdvancedEntryPage"
8+
BackgroundColor="White">
9+
<ContentPage.BindingContext>
10+
<vm:AdvancedEntryPageViewModel />
11+
</ContentPage.BindingContext>
12+
<ScrollView>
13+
<StackLayout Padding="30">
14+
<Label Text="You can see FormView Below:" />
15+
<BoxView HeightRequest="1" Color="LightGray" />
16+
<input:FormView IsValidated="{Binding IsValidated}">
17+
18+
<input:AdvancedEntry
19+
Title="Place your email below:"
20+
Annotation="Email"
21+
AnnotationColor="{StaticResource PrimaryColor}"
22+
IconImage="email.png"
23+
IsRequired="True"
24+
MaxLength="50"
25+
MinLength="10"
26+
Placeholder="[email protected]"
27+
Text="{Binding Email}"
28+
TextColor="Black"
29+
ValidationMessage="Please type a valid email address"
30+
ValidationPosition="Before" />
31+
32+
<input:AdvancedEntry
33+
Title="Place your name below:"
34+
Annotation="NonDigitsOnly"
35+
AnnotationColor="{StaticResource PrimaryColor}"
36+
IconImage="account.png"
37+
IsRequired="True"
38+
MaxLength="30"
39+
MinLength="5"
40+
Placeholder="John Doe"
41+
Text="{Binding NameSurname}"
42+
TextColor="Black"
43+
ValidationMessage="Please type your name correctly"
44+
ValidationPosition="After" />
45+
46+
<input:AdvancedEntry
47+
Title="Place your phone number below:"
48+
Annotation="Phone"
49+
AnnotationColor="{StaticResource PrimaryColor}"
50+
IconImage="phone.png"
51+
IsRequired="True"
52+
MaxLength="10"
53+
MinLength="8"
54+
Placeholder="5439998877"
55+
Text="{Binding Phone}"
56+
TextColor="Black"
57+
ValidationMessage="Please type your phone number correctly" />
58+
<Label Text="Choose your subscription type:" />
59+
<input:RadioButtonGroupView IsRequired="True">
60+
<input:RadioButton Text="Free" />
61+
<input:RadioButton Text="Bronze" />
62+
<input:RadioButton Text="Gold" />
63+
<input:RadioButton Text="Platinium" />
64+
</input:RadioButtonGroupView>
65+
66+
<input:CheckBox
67+
IsRequired="True"
68+
Text="I Accept User Agreement"
69+
Type="Material" />
70+
<Button
71+
Margin="0,20"
72+
BackgroundColor="{StaticResource PrimaryColor}"
73+
Command="{Binding SubmitCommand}"
74+
CornerRadius="20"
75+
Text="Submit"
76+
TextColor="White" />
77+
</input:FormView>
78+
</StackLayout>
79+
</ScrollView>
80+
</ContentPage>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Microsoft.Maui.Controls;
2+
3+
namespace SandboxMAUI.Pages;
4+
5+
public partial class AdvancedEntryPage : ContentPage
6+
{
7+
public AdvancedEntryPage()
8+
{
9+
InitializeComponent();
10+
}
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"
5+
x:Class="SandboxMAUI.Pages.AdvancedSliderPage"
6+
Title="AdvancedSliderPage">
7+
<ScrollView>
8+
<StackLayout Padding="25" Spacing="15">
9+
10+
<input:AdvancedSlider MaxValue="5000"
11+
MinValue="50"
12+
StepValue="50"
13+
Value="{Binding Price}"
14+
ValuePrefix="Offer:"
15+
ValueSuffix="$"
16+
Title="Choose Budget:"/>
17+
18+
</StackLayout>
19+
</ScrollView>
20+
</ContentPage>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Microsoft.Maui.Controls;
2+
3+
namespace SandboxMAUI.Pages;
4+
5+
public partial class AdvancedSliderPage : ContentPage
6+
{
7+
public AdvancedSliderPage()
8+
{
9+
InitializeComponent();
10+
}
11+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
3+
xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"
4+
x:Class="SandboxMAUI.Pages.CheckBoxPage"
5+
Title="CheckBoxPage"
6+
BackgroundColor="White">
7+
<ScrollView>
8+
<StackLayout
9+
x:Name="mainLayout"
10+
Padding="25"
11+
Spacing="15">
12+
13+
<Button Text="Randomize colors" Clicked="Button_Clicked" />
14+
15+
<BoxView Color="Black" HeightRequest="1" HorizontalOptions="Fill" Margin="5,10" />
16+
17+
<input:CheckBox Text="Option 0 with Box Type" Type="Box" LabelPosition="After"/>
18+
<input:CheckBox Text="Option 1 with Check Type" Type="Check" />
19+
<input:CheckBox Text="Option 2 wity Cross Type" Type="Cross" />
20+
<input:CheckBox Text="Option 3 with Custom Type" Type="Custom" CustomIcon="ic_account_balance_black"/>
21+
<input:CheckBox Text="Option 4 with Material Type" Type="Material" />
22+
<input:CheckBox Text="Option 5 with Star Type" Type="Star"/>
23+
<input:CheckBox Text="Option 6 (Position)" Type="Check" LabelPosition="Before"/>
24+
25+
</StackLayout>
26+
</ScrollView>
27+
</ContentPage>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using Microsoft.Maui.Controls;
3+
using Microsoft.Maui.Graphics;
4+
using CheckBox = InputKit.Shared.Controls.CheckBox;
5+
6+
namespace SandboxMAUI.Pages;
7+
8+
public partial class CheckBoxPage : ContentPage
9+
{
10+
public CheckBoxPage()
11+
{
12+
InitializeComponent();
13+
}
14+
Random rnd = new Random();
15+
private void Button_Clicked(object sender, EventArgs e)
16+
{
17+
var colors = typeof(Colors).GetFields();
18+
var color = (Color)colors[rnd.Next(colors.Length)].GetValue(null);
19+
foreach (var view in mainLayout.Children)
20+
{
21+
if (view is CheckBox chk)
22+
{
23+
chk.Color = color;
24+
}
25+
}
26+
27+
if(sender is Button button)
28+
{
29+
button.BackgroundColor = color;
30+
}
31+
}
32+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"
5+
x:Class="SandboxMAUI.Pages.RadioButtonPage"
6+
Title="RadioButtonPage">
7+
<ScrollView>
8+
<StackLayout Padding="25" Spacing="15">
9+
10+
<Button Text="Randomize Colors" Clicked="RandomizeColors" />
11+
<BoxView Color="Black" HeightRequest="1" HorizontalOptions="Fill" Margin="5,10" />
12+
13+
<input:RadioButtonGroupView x:Name="groupView">
14+
<input:RadioButton Text="Option 1" />
15+
<input:RadioButton Text="Option 2" />
16+
<input:RadioButton Text="Option 3 Label Position Before" LabelPosition="Before"/>
17+
<input:RadioButton Text="Option 4 with Custom Image" CheckedImage="circle_check"/>
18+
<input:RadioButton Text="Dolor ullamcorper sit justo magna luptatum at sit dolor sed accusam amet quod nostrud lobortis amet dolore et zzril et"/>
19+
<input:RadioButton Text="Option 5 Disabled" IsDisabled="True"/>
20+
</input:RadioButtonGroupView>
21+
22+
</StackLayout>
23+
</ScrollView>
24+
</ContentPage>

0 commit comments

Comments
 (0)