Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public override string ToString()
// Elements
new GalleryPageFactory(() => new ActivityIndicatorCoreGalleryPage(), "ActivityIndicator Gallery"),
new GalleryPageFactory(() => new BorderControlPage(), "Border Feature Matrix"),
new GalleryPageFactory(() => new DefaultThemePage(), "App Theme"),
new GalleryPageFactory(() => new BoxViewCoreGalleryPage(), "Box Gallery"),
new GalleryPageFactory(() => new ButtonControlPage(), "Button Feature Matrix"),
new GalleryPageFactory(() => new ButtonCoreGalleryPage(), "Button Gallery"),
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Maui.Controls.Sample;

public partial class AppThemePage : ContentPage
{
public AppThemePage()
{
InitializeComponent();
}

public void OnLightThemeButtonClicked(object sender, EventArgs e)
{
Application.Current.UserAppTheme = AppTheme.Light;
}

public void OnDarkThemeButtonClicked(object sender, EventArgs e)
{
Application.Current.UserAppTheme = AppTheme.Dark;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.DefaultMainThemePage"
xmlns:local="clr-namespace:Maui.Controls.Sample"
Title="DefaultThemePage">

<ContentPage.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ContentPage.Resources>

<ContentPage.ToolbarItems>
<ToolbarItem Text="AppThemePage"
Clicked="OnNavigateToAppThemePageClicked"
AutomationId="AppThemePage"/>
</ContentPage.ToolbarItems>

<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="0.5*, 0.5*"
RowSpacing="8.5"
ColumnSpacing="10"
HorizontalOptions="Center"
Margin="5,10,0,0">

<!-- Button -->
<Button Grid.Row="0"
Grid.Column="0"
AutomationId="DefaultLightThemeButton"
Text="Light Theme"
Clicked="OnLightThemeButtonClicked"
HorizontalOptions="Center"/>
<Button Grid.Row="0"
Grid.Column="1"
AutomationId="DefaultDarkThemeButton"
Text="Dark Theme"
Clicked="OnDarkThemeButtonClicked"
HorizontalOptions="Center"/>

<!-- Border -->
<HorizontalStackLayout Grid.Row="1"
Grid.Column="0">
<Label Text="Border: "
VerticalOptions="Center"/>
<Border Stroke="Red"
StrokeThickness="4"
StrokeShape="RoundRectangle"
Background="Green"
Padding="16,8"
HorizontalOptions="Center"/>
</HorizontalStackLayout>

<!-- CheckBox -->
<HorizontalStackLayout Grid.Row="1"
Grid.Column="1">
<Label Text="CheckBox: "
VerticalOptions="Center"/>
<CheckBox AutomationId="CheckBox"
IsChecked="True"/>
</HorizontalStackLayout>

<!-- DatePicker -->
<HorizontalStackLayout Grid.Row="2"
Grid.Column="0">
<Label Text="DatePicker: "
VerticalOptions="Center"/>
<DatePicker AutomationId="DatePicker"
Date="06/21/2022"/>
</HorizontalStackLayout>

<!-- Entry -->
<HorizontalStackLayout Grid.Row="2"
Grid.Column="1">
<Label Text="Entry: "
VerticalOptions="Center"/>
<local:UITestEntry AutomationId="Entry"
IsCursorVisible="False"
IsSpellCheckEnabled="False"
ClearButtonVisibility="WhileEditing"
Placeholder="Entry Placeholder"
Text="Entry Text"
WidthRequest="100"/>
</HorizontalStackLayout>

<!-- RadioButton -->
<HorizontalStackLayout Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2">
<Label Text="RadioButton: "
VerticalOptions="Center"/>
<StackLayout>
<RadioButton AutomationId="RadioButton_Cat"
Content="Cat"/>
<RadioButton AutomationId="RadioButton_Monkey"
Content="Monkey"
IsChecked="true"/>
</StackLayout>
</HorizontalStackLayout>

<!-- Editor -->
<HorizontalStackLayout Grid.Row="3"
Grid.Column="1">
<Label Text="Editor: "
VerticalOptions="Center"/>
<local:UITestEditor AutomationId="Editor"
IsCursorVisible="False"
IsSpellCheckEnabled="False"
Placeholder="Editor Placeholder"
Text="Editor Text"
WidthRequest="100"
HeightRequest="50"
VerticalOptions="Center"/>
</HorizontalStackLayout>

<!-- Image -->
<HorizontalStackLayout Grid.Row="4"
Grid.Column="0">
<Label Text="Image: "
VerticalOptions="Center"/>
<Image Source="dotnet_bot.png"
HeightRequest="50"/>
</HorizontalStackLayout>

<!-- BoxView -->
<HorizontalStackLayout Grid.Row="4"
Grid.Column="1">
<Label Text="BoxView: "
VerticalOptions="Center"/>
<BoxView Color="Blue"
WidthRequest="50"
HeightRequest="50"/>
</HorizontalStackLayout>

<!-- ImageButton -->
<HorizontalStackLayout Grid.Row="5"
Grid.Column="0">
<Label Text="ImageButton: "
VerticalOptions="Center"/>
<ImageButton Source="dotnet_bot.png"
HeightRequest="50"/>
</HorizontalStackLayout>

<!-- Shapes -->
<HorizontalStackLayout Grid.Row="5"
Grid.Column="1">
<Label Text="Rectangle: "
VerticalOptions="Center"/>
<Rectangle Fill="Red"
WidthRequest="100"
HeightRequest="50"
HorizontalOptions="Start"/>
</HorizontalStackLayout>

<!-- Picker -->
<HorizontalStackLayout Grid.Row="6"
Grid.Column="0"
Grid.ColumnSpan="2">
<Label Text="Picker: "
VerticalOptions="Center"/>
<Picker AutomationId="Picker"
x:Name="picker"
SelectedIndex="4"
Title="Select a monkey"
WidthRequest="200">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Baboon</x:String>
<x:String>Capuchin Monkey</x:String>
<x:String>Blue Monkey</x:String>
<x:String>Squirrel Monkey</x:String>
<x:String>Golden Lion Tamarin</x:String>
<x:String>Howler Monkey</x:String>
<x:String>Japanese Macaque</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</HorizontalStackLayout>

<!-- ProgressBar -->
<HorizontalStackLayout Grid.Row="7"
Grid.Column="0"
Grid.ColumnSpan="2">
<Label Text="ProgressBar: "
VerticalOptions="Center"/>
<ProgressBar Progress="0.5"
WidthRequest="300"/>
</HorizontalStackLayout>

<!-- SearchBar -->
<VerticalStackLayout Grid.Row="8"
Grid.Column="0"
Grid.ColumnSpan="2">
<local:UITestSearchBar AutomationId="SearchBar"
IsCursorVisible="False"
IsSpellCheckEnabled="False"
Placeholder="SearchBar Placeholder"
Text="SearchBar Control"/>
</VerticalStackLayout>

<!-- Slider -->
<HorizontalStackLayout Grid.Row="9"
Grid.Column="0"
Grid.ColumnSpan="2">
<Label x:Name="displayLabel"
Text="{Binding x:DataType='Slider', Source={x:Reference slider}, Path=Value, StringFormat='Slider: {0:F0}'}"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<Slider AutomationId="Slider"
x:Name="slider"
Maximum="360"
Minimum="100"
Value="150"
WidthRequest="300"/>
</HorizontalStackLayout>

<!-- Label -->
<HorizontalStackLayout Grid.Row="10"
Grid.Column="0">
<Label Text="Label: "
VerticalOptions="Center"/>
<Label Text="Label Text"
VerticalOptions="Center"/>
</HorizontalStackLayout>

<!-- Stepper -->
<HorizontalStackLayout Grid.Row="10"
Grid.Column="1">
<Label Text="{Binding x:DataType='Stepper', Source={x:Reference _stepper}, Path=Value, StringFormat='Stepper: {0:F0}'}"
VerticalOptions="Center"/>
<Stepper AutomationId="Stepper"
x:Name="_stepper"
Minimum="100"
Maximum="360"
Increment="30"
WidthRequest="100"/>
</HorizontalStackLayout>

<!-- Switch -->
<HorizontalStackLayout Grid.Row="11"
Grid.Column="0">
<Label Text="Switch: "
VerticalOptions="Center"/>
<Switch AutomationId="Switch"
IsToggled="True"/>
</HorizontalStackLayout>

<!-- TitleBar -->
<HorizontalStackLayout Grid.Row="11"
Grid.Column="1"
Grid.ColumnSpan="2">
<Label Text="TitleBar: "
VerticalOptions="Center"/>
<TitleBar Title="My App"/>
</HorizontalStackLayout>

<!-- TimePicker -->
<HorizontalStackLayout Grid.Row="12"
Grid.Column="1"
IsVisible="False">
<Label Text="TimePicker: "
VerticalOptions="Center"/>
<TimePicker AutomationId="TimePicker"
Format="HH:mm tt"
Time="4:00"/>
</HorizontalStackLayout>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace Maui.Controls.Sample;

public class DefaultThemePage : NavigationPage
{
public DefaultThemePage()
{
PushAsync(new DefaultMainThemePage());
}
}

public partial class DefaultMainThemePage : ContentPage
{
public DefaultMainThemePage()
{
InitializeComponent();
this.SetAppThemeColor(BackgroundColorProperty, Colors.White, Colors.Black);
}

public async void OnNavigateToAppThemePageClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new AppThemePage());
}

public void OnLightThemeButtonClicked(object sender, EventArgs e)
{
Application.Current.UserAppTheme = AppTheme.Light;
}

public void OnDarkThemeButtonClicked(object sender, EventArgs e)
{
Application.Current.UserAppTheme = AppTheme.Dark;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml -->

<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="PrimaryDark">#ac99ea</Color>
<Color x:Key="PrimaryDarkText">#242424</Color>
<Color x:Key="Secondary">#DFD8F7</Color>

<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color>
<Color x:Key="MidnightBlue">#190649</Color>

<Color x:Key="Gray100">#E1E1E1</Color>
<Color x:Key="Gray200">#C8C8C8</Color>
<Color x:Key="Gray300">#ACACAC</Color>
<Color x:Key="Gray400">#919191</Color>
<Color x:Key="Gray500">#6E6E6E</Color>
<Color x:Key="Gray600">#404040</Color>
<Color x:Key="Gray700">#525252</Color>
<Color x:Key="Gray800">#3f3f3f</Color>
<Color x:Key="Gray900">#212121</Color>
<Color x:Key="Gray950">#141414</Color>
</ResourceDictionary>
Loading
Loading