Skip to content

Commit c63d71b

Browse files
authored
Merge pull request #37 from egvijayanand/working
Samples updated to .NET MAUI GA
2 parents a79dbaa + 6f7d2f5 commit c63d71b

File tree

20 files changed

+237
-347
lines changed

20 files changed

+237
-347
lines changed

src/DateCalculator/DateCalculator.Maui/DateCalculator.Maui.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</ItemGroup>
5555

5656
<ItemGroup>
57-
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0-rc3" />
57+
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0" />
5858
<PackageReference Include="VijayAnand.FontAwesome" Version="2.1.1" />
5959
</ItemGroup>
6060

src/DateCalculator/DateCalculator.Maui/Resources/Styles.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436

437437
<Style x:Key="BaseStyle" TargetType="Element">
438438
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
439-
<Setter Property="Shell.ForegroundColor" Value="{StaticResource White}" />
439+
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />
440440
<Setter Property="Shell.TitleColor" Value="{StaticResource White}" />
441441
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
442442
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />

src/DateCalculator/DateCalculator.Shared/DateCalculator.Shared.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview3" />
13-
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
1413
</ItemGroup>
1514

1615
</Project>

src/DateCalculator/DateCalculator.Shared/ViewModels/HomeViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using MvvmHelpers;
1+
using VijayAnand.Toolkit.ObjectModel;
22

33
namespace DateCalculator.ViewModels
44
{

src/DateCalculator/DateCalculator.Shared/ViewModels/SettingsViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using MvvmHelpers;
1+
using VijayAnand.Toolkit.ObjectModel;
22

33
namespace DateCalculator.ViewModels
44
{

src/MauiAppCS/MauiAppCS/MauiAppCS.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
</ItemGroup>
5858

5959
<ItemGroup>
60-
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0-rc3"/>
61-
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0-pre12"/>
60+
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0"/>
61+
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0"/>
6262
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview3"/>
6363
</ItemGroup>
6464
</Project>

src/MauiBlazorApp/MauiBlazorApp/MauiBlazorApp.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
</ItemGroup>
5656

5757
<ItemGroup>
58-
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0-rc3" />
58+
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="1.0.0" />
5959
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
60-
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="1.0.0-pre7" />
61-
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0-pre11" />
60+
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="1.0.0" />
61+
<PackageReference Include="VijayAnand.MauiToolkit" Version="1.0.0" />
6262
</ItemGroup>
6363

6464
<ItemGroup>

src/TestApp/TestApp/App.xaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
66
xmlns:local="clr-namespace:TestApp">
77
<Application.Resources>
8-
<ResourceDictionary Source="Resources/Styles.xaml">
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<ResourceDictionary Source="Resources/Colors.xaml" />
11+
<ResourceDictionary Source="Resources/Styles.xaml" />
12+
</ResourceDictionary.MergedDictionaries>
913

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

1216
<Style x:Key="MauiLabel" TargetType="Label">
13-
<Setter Property="TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource MauiColor}}" />
17+
<Setter Property="TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource Primary}}" />
1418
</Style>
1519

1620
<Style ApplyToDerivedTypes="True" TargetType="StackBase">
@@ -24,7 +28,6 @@
2428
<Style x:Key="PrimaryAction" TargetType="Button">
2529
<Setter Property="BackgroundColor" Value="{DynamicResource Primary}" />
2630
<Setter Property="TextColor" Value="{DynamicResource PrimaryText}" />
27-
<Setter Property="FontAttributes" Value="Bold" />
2831
</Style>
2932

3033
</ResourceDictionary>

src/TestApp/TestApp/AppShell.xaml

-73
Original file line numberDiff line numberDiff line change
@@ -12,79 +12,6 @@
1212
Ensure atleast a Flyout item or a TabBar is defined for Shell to work
1313
-->
1414
<Shell.Resources>
15-
<ResourceDictionary>
16-
17-
<!--<Style x:Key="BaseStyle" TargetType="Element">
18-
<Setter Property="Shell.BackgroundColor" Value="{StaticResource PrimaryColor}" />
19-
<Setter Property="Shell.ForegroundColor" Value="{StaticResource PrimaryTextColor}" />
20-
<Setter Property="Shell.TitleColor" Value="{StaticResource PrimaryTextColor}" />
21-
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
22-
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
23-
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource PrimaryColor}" />
24-
<Setter Property="Shell.TabBarForegroundColor" Value="White" />
25-
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF" />
26-
<Setter Property="Shell.TabBarTitleColor" Value="White" />
27-
</Style>
28-
29-
<Style
30-
ApplyToDerivedTypes="True"
31-
BasedOn="{StaticResource BaseStyle}"
32-
TargetType="ShellItem" />-->
33-
34-
<!--
35-
Default Styles for all Flyout Items
36-
-->
37-
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
38-
<Setter Property="FontFamily" Value="{StaticResource AppFont}" />
39-
<Setter Property="TextColor" Value="{StaticResource TextLight}" />
40-
</Style>
41-
<Style
42-
ApplyToDerivedTypes="True"
43-
Class="FlyoutItemLayoutStyle"
44-
TargetType="Layout">
45-
<Setter Property="VisualStateManager.VisualStateGroups">
46-
<VisualStateGroupList>
47-
<VisualStateGroup x:Name="CommonStates">
48-
<VisualState x:Name="Normal">
49-
<VisualState.Setters>
50-
<Setter Property="BackgroundColor" Value="{OnPlatform iOS=White, Default=Transparent}" />
51-
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Default={StaticResource TextLight}}" />
52-
<Setter Property="VerticalOptions" Value="Center" />
53-
</VisualState.Setters>
54-
</VisualState>
55-
<VisualState x:Name="Selected">
56-
<VisualState.Setters>
57-
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" />
58-
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="White" />
59-
<Setter Property="VerticalOptions" Value="Center" />
60-
</VisualState.Setters>
61-
</VisualState>
62-
</VisualStateGroup>
63-
</VisualStateGroupList>
64-
</Setter>
65-
</Style>
66-
67-
<!--
68-
Custom Style you can apply to any Flyout Item
69-
-->
70-
<Style
71-
ApplyToDerivedTypes="True"
72-
Class="MenuItemLayoutStyle"
73-
TargetType="Layout">
74-
<Setter Property="VisualStateManager.VisualStateGroups">
75-
<VisualStateGroupList>
76-
<VisualStateGroup x:Name="CommonStates">
77-
<VisualState x:Name="Normal">
78-
<VisualState.Setters>
79-
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource TextLight}}" />
80-
<Setter Property="VerticalOptions" Value="Center" />
81-
</VisualState.Setters>
82-
</VisualState>
83-
</VisualStateGroup>
84-
</VisualStateGroupList>
85-
</Setter>
86-
</Style>
87-
</ResourceDictionary>
8815
<!--#region Icons-->
8916
<!-- Home -->
9017
<FontImageSource

src/TestApp/TestApp/HomePage.xaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
66
xmlns:local="clr-namespace:TestApp"
77
Title="Home">
8-
<Grid Style="{StaticResource ContentArea}">
9-
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
10-
<Label Text="Home Page" />
11-
</StackLayout>
12-
</Grid>
8+
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
9+
<Label Text="Home Page" />
10+
</StackLayout>
1311
</ContentPage>

src/TestApp/TestApp/LoginPage.xaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
xmlns:local="clr-namespace:TestApp"
77
Title="Login"
88
Shell.NavBarIsVisible="False">
9-
<Grid Style="{StaticResource ContentArea}">
10-
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
11-
<Button
12-
Clicked="OnLoginClicked"
13-
Style="{StaticResource PrimaryAction}"
14-
Text="Login" />
15-
</StackLayout>
16-
</Grid>
9+
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
10+
<Button
11+
Clicked="OnLoginClicked"
12+
Style="{StaticResource PrimaryAction}"
13+
Text="Login" />
14+
</StackLayout>
1715
</ContentPage>

src/TestApp/TestApp/MainPage.xaml

+40-43
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,50 @@
66
Title="{OnIdiom Desktop='',
77
Default='.NET MAUI'}"
88
Shell.PresentationMode="ModalAnimated">
9-
<Grid Style="{StaticResource ContentArea}">
10-
<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
11-
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*" RowSpacing="25">
9+
<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
10+
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*" RowSpacing="25">
1211

13-
<Label
14-
Grid.Row="0"
15-
FontSize="32"
16-
HorizontalOptions="Center"
17-
SemanticProperties.HeadingLevel="Level1"
18-
Style="{StaticResource MauiLabel}"
19-
Text="Hello, World!" />
12+
<Label
13+
Grid.Row="0"
14+
FontSize="32"
15+
HorizontalOptions="Center"
16+
SemanticProperties.HeadingLevel="Level1"
17+
Style="{StaticResource MauiLabel}"
18+
Text="Hello, World!" />
2019

21-
<Label
22-
Grid.Row="1"
23-
FontSize="18"
24-
HorizontalOptions="Center"
25-
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
26-
SemanticProperties.HeadingLevel="Level1"
27-
Style="{StaticResource MauiLabel}"
28-
Text="Welcome to .NET Multi-platform App UI" />
20+
<Label
21+
Grid.Row="1"
22+
FontSize="18"
23+
HorizontalOptions="Center"
24+
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
25+
SemanticProperties.HeadingLevel="Level1"
26+
Style="{StaticResource MauiLabel}"
27+
Text="Welcome to .NET Multi-platform App UI" />
2928

30-
<Label
31-
x:Name="CounterLabel"
32-
Grid.Row="2"
33-
FontAttributes="Bold"
34-
FontSize="18"
35-
HorizontalOptions="Center"
36-
Style="{StaticResource MauiLabel}"
37-
Text="Current count: 0" />
29+
<Label
30+
x:Name="CounterLabel"
31+
Grid.Row="2"
32+
FontSize="18"
33+
HorizontalOptions="Center"
34+
Style="{StaticResource MauiLabel}"
35+
Text="Current count: 0" />
3836

39-
<Button
40-
Grid.Row="3"
41-
Clicked="OnCounterClicked"
42-
HorizontalOptions="Center"
43-
SemanticProperties.Hint="Counts the number of times you click"
44-
Style="{StaticResource PrimaryAction}"
45-
Text="Click me" />
37+
<Button
38+
Grid.Row="3"
39+
Clicked="OnCounterClicked"
40+
HorizontalOptions="Center"
41+
SemanticProperties.Hint="Counts the number of times you click"
42+
Style="{StaticResource PrimaryAction}"
43+
Text="Click me" />
4644

47-
<Image
48-
Grid.Row="4"
49-
HeightRequest="310"
50-
HorizontalOptions="Center"
51-
SemanticProperties.Description="Cute dot net bot waving hi to you!"
52-
Source="dotnet_bot.png"
53-
WidthRequest="250" />
45+
<Image
46+
Grid.Row="4"
47+
HeightRequest="310"
48+
HorizontalOptions="Center"
49+
SemanticProperties.Description="Cute dot net bot waving hi to you!"
50+
Source="dotnet_bot.png"
51+
WidthRequest="250" />
5452

55-
</Grid>
56-
</ScrollView>
57-
</Grid>
53+
</Grid>
54+
</ScrollView>
5855
</ContentPage>
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<?xaml-comp compile="true" ?>
3+
<ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
5+
6+
<Color x:Key="Primary">#512BD4</Color>
7+
<Color x:Key="Secondary">#DFD8F7</Color>
8+
<Color x:Key="Tertiary">#2B0B98</Color>
9+
<Color x:Key="White">White</Color>
10+
<Color x:Key="Black">Black</Color>
11+
<Color x:Key="Gray100">#E1E1E1</Color>
12+
<Color x:Key="Gray200">#C8C8C8</Color>
13+
<Color x:Key="Gray300">#ACACAC</Color>
14+
<Color x:Key="Gray400">#919191</Color>
15+
<Color x:Key="Gray500">#6E6E6E</Color>
16+
<Color x:Key="Gray600">#404040</Color>
17+
<Color x:Key="Gray900">#212121</Color>
18+
<Color x:Key="Gray950">#141414</Color>
19+
20+
<Color x:Key="Light">#DFD8F7</Color>
21+
<Color x:Key="Dark">#2B0B98</Color>
22+
<Color x:Key="LightGray">#E5E5E1</Color>
23+
<Color x:Key="MidGray">#969696</Color>
24+
<Color x:Key="DarkGray">#505050</Color>
25+
26+
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
27+
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
28+
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
29+
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
30+
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
31+
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
32+
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
33+
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
34+
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/>
35+
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/>
36+
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/>
37+
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
38+
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>
39+
40+
<SolidColorBrush x:Key="LightBrush" Color="{StaticResource Light}" />
41+
<SolidColorBrush x:Key="DarkBrush" Color="{StaticResource Dark}" />
42+
<SolidColorBrush x:Key="LightGrayBrush" Color="{StaticResource LightGray}" />
43+
<SolidColorBrush x:Key="MidGrayBrush" Color="{StaticResource MidGray}" />
44+
<SolidColorBrush x:Key="DarkGrayBrush" Color="{StaticResource DarkGray}" />
45+
46+
<!-- Dark and Light App Theme -->
47+
<Color x:Key="BackgroundDark">#121212</Color>
48+
<Color x:Key="BackgroundLight">White</Color>
49+
<Color x:Key="TextDark">White</Color>
50+
<Color x:Key="TextLight">Black</Color>
51+
52+
<Color x:Key="Yellow100Accent">#F7B548</Color>
53+
<Color x:Key="Yellow200Accent">#FFD590</Color>
54+
<Color x:Key="Yellow300Accent">#FFE5B9</Color>
55+
<Color x:Key="Cyan100Accent">#28C2D1</Color>
56+
<Color x:Key="Cyan200Accent">#7BDDEF</Color>
57+
<Color x:Key="Cyan300Accent">#C3F2F4</Color>
58+
<Color x:Key="Blue100Accent">#3E8EED</Color>
59+
<Color x:Key="Blue200Accent">#72ACF1</Color>
60+
<Color x:Key="Blue300Accent">#A7CBF6</Color>
61+
62+
</ResourceDictionary>

0 commit comments

Comments
 (0)