Skip to content

Commit

Permalink
Demo Project - Moved styles to the global resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrmanzano committed Apr 22, 2022
1 parent 67d2449 commit 2ec4565
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@
x:Name="this">

<ContentView.Resources>
<Color x:Key="CtrlBackground">#f6f6f6</Color>
<!-- Implicit styles -->
<Style TargetType="{x:Type Entry}">
<Setter Property="BackgroundColor" Value="{x:DynamicResource CtrlBackground}" />
</Style>

<Style TargetType="{x:Type Label}">
<Setter Property="Margin" Value="0,10,0,0" />
</Style>

<Style TargetType="{x:Type DatePicker}">
<Setter Property="BackgroundColor" Value="{x:DynamicResource CtrlBackground}" />
</Style>
</ContentView.Resources>

<VerticalStackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ namespace Maui.BindableProperty.Generator.Demo.CustomControls
{
public partial class HeaderControl : ContentView
{
#pragma warning disable CS0169

[AutoBindable(OnChanged = nameof(UpdateDisplayName))]
private string _firstName;
private readonly string _firstName;

[AutoBindable(PropertyName = "LastName", OnChanged = nameof(UpdateDisplayName))]
private string _l;
private readonly string _l;

[AutoBindable(DefaultValue = "DateTime.Now", OnChanged = nameof(OnDateTimeChanged))]
private DateTime _birthDate;
private readonly DateTime _birthDate;

[AutoBindable(DefaultValue = "USA")]
private string _country;
private readonly string _country;

[AutoBindable]
private string _displayName;
private readonly string _displayName;

#pragma warning restore CS0169

public HeaderControl()
{
Expand Down
8 changes: 0 additions & 8 deletions src/Maui.BindableProperty.Generator.Demo/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
xmlns:controls="clr-namespace:Maui.BindableProperty.Generator.Demo.CustomControls"
x:Name="this">

<ContentPage.Resources>
<Color x:Key="CtrlBackground">#f6f6f6</Color>
<!-- Implicit styles -->
<Style TargetType="{x:Type Editor}">
<Setter Property="BackgroundColor" Value="{x:DynamicResource CtrlBackground}" />
</Style>
</ContentPage.Resources>

<ScrollView>
<VerticalStackLayout Spacing="25" Padding="30">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
</Style>

<Style TargetType="DatePicker">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
Expand All @@ -122,6 +123,7 @@
</Style>

<Style TargetType="Editor">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
Expand All @@ -146,6 +148,7 @@

<Style TargetType="Entry">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.Text;

namespace Maui.BindableProperty.Generator.Demo.ViewModels
{
Expand Down

0 comments on commit 2ec4565

Please sign in to comment.