Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.800" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.800" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand Down
57 changes: 26 additions & 31 deletions UserInterface/SystemThemesDemo/SystemThemesDemo/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,39 @@
x:Class="SystemThemesDemo.App">
<Application.Resources>

<AppThemeColor x:Key="PageBackgroundColor"
Light="White"
Dark="Black" />
<AppThemeColor x:Key="NavigationBarColor"
Light="WhiteSmoke"
Dark="Teal" />
<AppThemeColor x:Key="PrimaryColor"
Light="WhiteSmoke"
Dark="Teal" />
<AppThemeColor x:Key="SecondaryColor"
Light="Black"
Dark="White" />
<AppThemeColor x:Key="PrimaryTextColor"
Light="Black"
Dark="White" />
<AppThemeColor x:Key="SecondaryTextColor"
Light="White"
Dark="White" />
<AppThemeColor x:Key="TertiaryTextColor"
Light="Gray"
Dark="WhiteSmoke" />
<AppThemeColor x:Key="TransparentColor"
Light="Transparent"
Dark="Transparent" />
<Color x:Key="TransparentColor">Transparent</Color>

<!-- Light colors -->
<Color x:Key="LightPageBackgroundColor">White</Color>
<Color x:Key="LightNavigationBarColor">WhiteSmoke</Color>
<Color x:Key="LightPrimaryColor">WhiteSmoke</Color>
<Color x:Key="LightSecondaryColor">Black</Color>
<Color x:Key="LightPrimaryTextColor">Black</Color>
<Color x:Key="LightSecondaryTextColor">White</Color>
<Color x:Key="LightTertiaryTextColor">Gray</Color>

<!-- Dark colors -->
<Color x:Key="DarkPageBackgroundColor">Black</Color>
<Color x:Key="DarkNavigationBarColor">Teal</Color>
<Color x:Key="DarkPrimaryColor">Teal</Color>
<Color x:Key="DarkSecondaryColor">White</Color>
<Color x:Key="DarkPrimaryTextColor">White</Color>
<Color x:Key="DarkSecondaryTextColor">White</Color>
<Color x:Key="DarkTertiaryTextColor">WhiteSmoke</Color>

<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor"
Value="{DynamicResource NavigationBarColor}" />
Value="{AppThemeBinding Light={StaticResource LightNavigationBarColor}, Dark={StaticResource DarkNavigationBarColor}}" />
<Setter Property="BarTextColor"
Value="{DynamicResource SecondaryColor}" />
Value="{AppThemeBinding Light={StaticResource LightSecondaryColor}, Dark={StaticResource DarkSecondaryColor}}" />
</Style>

<Style x:Key="ButtonStyle"
TargetType="Button">
<Setter Property="BackgroundColor"
Value="{DynamicResource PrimaryColor}" />
Value="{AppThemeBinding Light={StaticResource LightPrimaryColor}, Dark={StaticResource DarkPrimaryColor}}" />
<Setter Property="TextColor"
Value="{DynamicResource SecondaryColor}" />
Value="{AppThemeBinding Light={StaticResource LightSecondaryColor}, Dark={StaticResource DarkSecondaryColor}}" />
<Setter Property="HeightRequest"
Value="45" />
<Setter Property="WidthRequest"
Expand All @@ -56,23 +51,23 @@
<Style x:Key="LargeLabelStyle"
TargetType="Label">
<Setter Property="TextColor"
Value="{DynamicResource SecondaryTextColor}" />
Value="{AppThemeBinding Light={StaticResource LightSecondaryTextColor}, Dark={StaticResource DarkSecondaryTextColor}}" />
<Setter Property="FontSize"
Value="30" />
</Style>

<Style x:Key="MediumLabelStyle"
TargetType="Label">
<Setter Property="TextColor"
Value="{DynamicResource PrimaryTextColor}" />
Value="{AppThemeBinding Light={StaticResource LightPrimaryTextColor}, Dark={StaticResource DarkPrimaryTextColor}}" />
<Setter Property="FontSize"
Value="25" />
</Style>

<Style x:Key="SmallLabelStyle"
TargetType="Label">
<Setter Property="TextColor"
Value="{DynamicResource TertiaryTextColor}" />
Value="{AppThemeBinding Light={StaticResource LightTertiaryTextColor}, Dark={StaticResource DarkTertiaryTextColor}}" />
<Setter Property="FontSize"
Value="15" />
</Style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.800" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:local="clr-namespace:SystemThemesDemo"
x:Class="SystemThemesDemo.Views.UserDetailsPage"
Title="User Details"
BackgroundColor="{DynamicResource PageBackgroundColor}">
BackgroundColor="{AppThemeBinding Light={StaticResource LightPageBackgroundColor}, Dark={StaticResource DarkPageBackgroundColor}}">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
Expand All @@ -15,7 +15,7 @@
</Grid.RowDefinitions>
<Image Source="{local:ImageResource SystemThemesDemo.Images.FacePalm.jpg}"
Aspect="AspectFill" />
<Grid BackgroundColor="{DynamicResource TransparentBackgroundColor}">
<Grid BackgroundColor="{StaticResource TransparentColor}">
<Label VerticalOptions="End"
Margin="15"
Style="{StaticResource LargeLabelStyle}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
xmlns:local="clr-namespace:SystemThemesDemo"
x:Class="SystemThemesDemo.Views.UserSummaryPage"
Title="User Summary"
BackgroundColor="{DynamicResource PageBackgroundColor}">
BackgroundColor="{AppThemeBinding Light={StaticResource LightPageBackgroundColor}, Dark={StaticResource DarkPageBackgroundColor}}">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition Height="120" />
<RowDefinition Height="70" />
</Grid.RowDefinitions>
<Grid BackgroundColor="{DynamicResource PrimaryColor}">
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource LightPrimaryColor}, Dark={StaticResource DarkPrimaryColor}}">
<Label Text="Face-Palm Monkey"
VerticalOptions="Center"
Margin="15"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms">
<Version>4.6.0.726</Version>
<Version>4.6.0.967</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.12" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms">
<Version>4.6.0.726</Version>
<Version>4.6.0.967</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MarkupExtensions.OnAppThemeDemoPage"
Title="OnAppTheme Demo">
x:Class="MarkupExtensions.AppThemeBindingDemoPage"
Title="AppThemeBinding Demo">
<ContentPage.Resources>

<Style x:Key="labelStyle"
TargetType="Label">
<Setter Property="TextColor"
Value="{OnAppTheme Black, Light=Blue, Dark=Teal}" />
Value="{AppThemeBinding Black, Light=Blue, Dark=Teal}" />
</Style>

</ContentPage.Resources>
<StackLayout Margin="20">
<Label Text="This text is green in light mode, and red in dark mode."
TextColor="{OnAppTheme Light=Green, Dark=Red}" />
TextColor="{AppThemeBinding Light=Green, Dark=Red}" />
<Label Text="This text is black by default, blue in light mode, and teal in dark mode."
Style="{DynamicResource labelStyle}" />
</StackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace MarkupExtensions
{
public partial class OnAppThemeDemoPage : ContentPage
public partial class AppThemeBindingDemoPage : ContentPage
{
public OnAppThemeDemoPage()
public AppThemeBindingDemoPage()
{
InitializeComponent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
Command="{Binding NavigateCommand}"
CommandParameter="{x:Type local:HslColorDemoPage}" />

<TextCell Text="OnAppTheme Demo"
<TextCell Text="AppThemeBinding Demo"
Detail="Specify resources per system theme"
Command="{Binding NavigateCommand}"
CommandParameter="{x:Type local:OnAppThemeDemoPage}" />
CommandParameter="{x:Type local:AppThemeBindingDemoPage}" />

<TextCell Text="Image Resource Demo"
Detail="Use a custom markup extension to access bitmaps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
<Compile Remove="OnPlatformPage.xaml.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />
</ItemGroup>
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.