Skip to content

Commit

Permalink
Merge pull request #37 from egvijayanand/working
Browse files Browse the repository at this point in the history
Samples updated to .NET MAUI GA
  • Loading branch information
egvijayanand authored May 24, 2022
2 parents a79dbaa + 6f7d2f5 commit c63d71b
Show file tree
Hide file tree
Showing 20 changed files with 237 additions and 347 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0-rc3" />
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0" />
<PackageReference Include="VijayAnand.FontAwesome" Version="2.1.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@

<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.ForegroundColor" Value="{StaticResource White}" />
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />
<Setter Property="Shell.TitleColor" Value="{StaticResource White}" />
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview3" />
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MvvmHelpers;
using VijayAnand.Toolkit.ObjectModel;

namespace DateCalculator.ViewModels
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MvvmHelpers;
using VijayAnand.Toolkit.ObjectModel;

namespace DateCalculator.ViewModels
{
Expand Down
4 changes: 2 additions & 2 deletions src/MauiAppCS/MauiAppCS/MauiAppCS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0-rc3"/>
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0-pre12"/>
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0"/>
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0"/>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview3"/>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/MauiBlazorApp/MauiBlazorApp/MauiBlazorApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0-rc3" />
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="1.0.0-pre7" />
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0-pre11" />
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="1.0.0" />
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/TestApp/TestApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp">
<Application.Resources>
<ResourceDictionary Source="Resources/Styles.xaml">
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>

<x:Double x:Key="ItemSpacing">10</x:Double>

<Style x:Key="MauiLabel" TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource MauiColor}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource Primary}}" />
</Style>

<Style ApplyToDerivedTypes="True" TargetType="StackBase">
Expand All @@ -24,7 +28,6 @@
<Style x:Key="PrimaryAction" TargetType="Button">
<Setter Property="BackgroundColor" Value="{DynamicResource Primary}" />
<Setter Property="TextColor" Value="{DynamicResource PrimaryText}" />
<Setter Property="FontAttributes" Value="Bold" />
</Style>

</ResourceDictionary>
Expand Down
73 changes: 0 additions & 73 deletions src/TestApp/TestApp/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,79 +12,6 @@
Ensure atleast a Flyout item or a TabBar is defined for Shell to work
-->
<Shell.Resources>
<ResourceDictionary>

<!--<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="Shell.ForegroundColor" Value="{StaticResource PrimaryTextColor}" />
<Setter Property="Shell.TitleColor" Value="{StaticResource PrimaryTextColor}" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White" />
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarTitleColor" Value="White" />
</Style>
<Style
ApplyToDerivedTypes="True"
BasedOn="{StaticResource BaseStyle}"
TargetType="ShellItem" />-->

<!--
Default Styles for all Flyout Items
-->
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
<Setter Property="FontFamily" Value="{StaticResource AppFont}" />
<Setter Property="TextColor" Value="{StaticResource TextLight}" />
</Style>
<Style
ApplyToDerivedTypes="True"
Class="FlyoutItemLayoutStyle"
TargetType="Layout">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{OnPlatform iOS=White, Default=Transparent}" />
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Default={StaticResource TextLight}}" />
<Setter Property="VerticalOptions" Value="Center" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="White" />
<Setter Property="VerticalOptions" Value="Center" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>

<!--
Custom Style you can apply to any Flyout Item
-->
<Style
ApplyToDerivedTypes="True"
Class="MenuItemLayoutStyle"
TargetType="Layout">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource TextLight}}" />
<Setter Property="VerticalOptions" Value="Center" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
</ResourceDictionary>
<!--#region Icons-->
<!-- Home -->
<FontImageSource
Expand Down
8 changes: 3 additions & 5 deletions src/TestApp/TestApp/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp"
Title="Home">
<Grid Style="{StaticResource ContentArea}">
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="Home Page" />
</StackLayout>
</Grid>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="Home Page" />
</StackLayout>
</ContentPage>
14 changes: 6 additions & 8 deletions src/TestApp/TestApp/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
xmlns:local="clr-namespace:TestApp"
Title="Login"
Shell.NavBarIsVisible="False">
<Grid Style="{StaticResource ContentArea}">
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Button
Clicked="OnLoginClicked"
Style="{StaticResource PrimaryAction}"
Text="Login" />
</StackLayout>
</Grid>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Button
Clicked="OnLoginClicked"
Style="{StaticResource PrimaryAction}"
Text="Login" />
</StackLayout>
</ContentPage>
83 changes: 40 additions & 43 deletions src/TestApp/TestApp/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,50 @@
Title="{OnIdiom Desktop='',
Default='.NET MAUI'}"
Shell.PresentationMode="ModalAnimated">
<Grid Style="{StaticResource ContentArea}">
<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*" RowSpacing="25">
<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*" RowSpacing="25">

<Label
Grid.Row="0"
FontSize="32"
HorizontalOptions="Center"
SemanticProperties.HeadingLevel="Level1"
Style="{StaticResource MauiLabel}"
Text="Hello, World!" />
<Label
Grid.Row="0"
FontSize="32"
HorizontalOptions="Center"
SemanticProperties.HeadingLevel="Level1"
Style="{StaticResource MauiLabel}"
Text="Hello, World!" />

<Label
Grid.Row="1"
FontSize="18"
HorizontalOptions="Center"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
SemanticProperties.HeadingLevel="Level1"
Style="{StaticResource MauiLabel}"
Text="Welcome to .NET Multi-platform App UI" />
<Label
Grid.Row="1"
FontSize="18"
HorizontalOptions="Center"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
SemanticProperties.HeadingLevel="Level1"
Style="{StaticResource MauiLabel}"
Text="Welcome to .NET Multi-platform App UI" />

<Label
x:Name="CounterLabel"
Grid.Row="2"
FontAttributes="Bold"
FontSize="18"
HorizontalOptions="Center"
Style="{StaticResource MauiLabel}"
Text="Current count: 0" />
<Label
x:Name="CounterLabel"
Grid.Row="2"
FontSize="18"
HorizontalOptions="Center"
Style="{StaticResource MauiLabel}"
Text="Current count: 0" />

<Button
Grid.Row="3"
Clicked="OnCounterClicked"
HorizontalOptions="Center"
SemanticProperties.Hint="Counts the number of times you click"
Style="{StaticResource PrimaryAction}"
Text="Click me" />
<Button
Grid.Row="3"
Clicked="OnCounterClicked"
HorizontalOptions="Center"
SemanticProperties.Hint="Counts the number of times you click"
Style="{StaticResource PrimaryAction}"
Text="Click me" />

<Image
Grid.Row="4"
HeightRequest="310"
HorizontalOptions="Center"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
Source="dotnet_bot.png"
WidthRequest="250" />
<Image
Grid.Row="4"
HeightRequest="310"
HorizontalOptions="Center"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
Source="dotnet_bot.png"
WidthRequest="250" />

</Grid>
</ScrollView>
</Grid>
</Grid>
</ScrollView>
</ContentPage>
62 changes: 62 additions & 0 deletions src/TestApp/TestApp/Resources/Colors.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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">

<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="Secondary">#DFD8F7</Color>
<Color x:Key="Tertiary">#2B0B98</Color>
<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</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="Gray900">#212121</Color>
<Color x:Key="Gray950">#141414</Color>

<Color x:Key="Light">#DFD8F7</Color>
<Color x:Key="Dark">#2B0B98</Color>
<Color x:Key="LightGray">#E5E5E1</Color>
<Color x:Key="MidGray">#969696</Color>
<Color x:Key="DarkGray">#505050</Color>

<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/>
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/>
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/>
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>

<SolidColorBrush x:Key="LightBrush" Color="{StaticResource Light}" />
<SolidColorBrush x:Key="DarkBrush" Color="{StaticResource Dark}" />
<SolidColorBrush x:Key="LightGrayBrush" Color="{StaticResource LightGray}" />
<SolidColorBrush x:Key="MidGrayBrush" Color="{StaticResource MidGray}" />
<SolidColorBrush x:Key="DarkGrayBrush" Color="{StaticResource DarkGray}" />

<!-- Dark and Light App Theme -->
<Color x:Key="BackgroundDark">#121212</Color>
<Color x:Key="BackgroundLight">White</Color>
<Color x:Key="TextDark">White</Color>
<Color x:Key="TextLight">Black</Color>

<Color x:Key="Yellow100Accent">#F7B548</Color>
<Color x:Key="Yellow200Accent">#FFD590</Color>
<Color x:Key="Yellow300Accent">#FFE5B9</Color>
<Color x:Key="Cyan100Accent">#28C2D1</Color>
<Color x:Key="Cyan200Accent">#7BDDEF</Color>
<Color x:Key="Cyan300Accent">#C3F2F4</Color>
<Color x:Key="Blue100Accent">#3E8EED</Color>
<Color x:Key="Blue200Accent">#72ACF1</Color>
<Color x:Key="Blue300Accent">#A7CBF6</Color>

</ResourceDictionary>
Loading

0 comments on commit c63d71b

Please sign in to comment.