diff --git a/ch02_DesigningViews/ex_CustomToolbar/App.xaml b/ch02_DesigningViews/ex_CustomToolbar/App.xaml
index 4eaeefe..89ed686 100644
--- a/ch02_DesigningViews/ex_CustomToolbar/App.xaml
+++ b/ch02_DesigningViews/ex_CustomToolbar/App.xaml
@@ -8,6 +8,7 @@
+
diff --git a/ch02_DesigningViews/ex_CustomToolbar/AppShell.xaml b/ch02_DesigningViews/ex_CustomToolbar/AppShell.xaml
index 811451f..bcc36f2 100644
--- a/ch02_DesigningViews/ex_CustomToolbar/AppShell.xaml
+++ b/ch02_DesigningViews/ex_CustomToolbar/AppShell.xaml
@@ -7,7 +7,7 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Shell.FlyoutBehavior="Disabled"
Shell.Padding="0"
- Shell.BackgroundColor="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}"
+ Shell.BackgroundColor="{DynamicResource PrimaryBackgroundColor}"
Title="ex_CustomToolbar">
@@ -65,11 +65,26 @@
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
+
+
+
+
+ Dark
+ Light
+ Color Blind
+
+
+
new DarkTheme(),
+ "Light" => new LightTheme(),
+ "Color Blind" => new ColorBlindTheme(),
+ _ => new LightTheme()
+ };
+
+ ICollection mergedDictionaries = Application.Current.Resources.MergedDictionaries;
+ if (mergedDictionaries != null)
+ {
+ foreach(var dico in mergedDictionaries.Where(d => d is ICustomTheme).ToList())
+ {
+ mergedDictionaries.Remove(dico);
+ }
+ mergedDictionaries.Add(chosenTheme);
+
+ #if ANDROID
+ CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor((Color)Application.Current.Resources["PrimaryBackgroundColor"]);
+ #endif
+ }
+ }
+
private void EllipsisClicked(object sender, EventArgs e)
{
secondaryMenu.IsVisible = !secondaryMenu.IsVisible;
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml
new file mode 100644
index 0000000..b071f0d
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml
@@ -0,0 +1,10 @@
+
+
+ #92CCDC
+ #E1C2CE
+
+ #163D42
+ #446E77
+
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml.cs b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml.cs
new file mode 100644
index 0000000..f91d29e
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ColorBlindTheme.xaml.cs
@@ -0,0 +1,9 @@
+namespace ex_CustomToolbar;
+
+public partial class ColorBlindTheme : ResourceDictionary, ICustomTheme
+{
+ public ColorBlindTheme()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml
new file mode 100644
index 0000000..2b13fa0
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml
@@ -0,0 +1,12 @@
+
+
+
+ #2F2883
+ #36743B
+
+ #96CBEA
+ #DBCB82
+
+
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml.cs b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml.cs
new file mode 100644
index 0000000..6d26522
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/DarkTheme.xaml.cs
@@ -0,0 +1,9 @@
+namespace ex_CustomToolbar;
+
+public partial class DarkTheme : ResourceDictionary, ICustomTheme
+{
+ public DarkTheme()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ICustomTheme.cs b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ICustomTheme.cs
new file mode 100644
index 0000000..16953fc
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/ICustomTheme.cs
@@ -0,0 +1,6 @@
+namespace ex_CustomToolbar;
+
+public interface ICustomTheme
+{
+
+}
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml
new file mode 100644
index 0000000..721ac54
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml
@@ -0,0 +1,10 @@
+
+
+ #96CBEA
+ #DBCB82
+
+ #2F2883
+ #36743B
+
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml.cs b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml.cs
new file mode 100644
index 0000000..b77d820
--- /dev/null
+++ b/ch02_DesigningViews/ex_CustomToolbar/Resources/Themes/LightTheme.xaml.cs
@@ -0,0 +1,9 @@
+namespace ex_CustomToolbar;
+
+public partial class LightTheme : ResourceDictionary, ICustomTheme
+{
+ public LightTheme()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/ch02_DesigningViews/ex_CustomToolbar/ex_CustomToolbar.csproj b/ch02_DesigningViews/ex_CustomToolbar/ex_CustomToolbar.csproj
index ac8dd1e..a935737 100644
--- a/ch02_DesigningViews/ex_CustomToolbar/ex_CustomToolbar.csproj
+++ b/ch02_DesigningViews/ex_CustomToolbar/ex_CustomToolbar.csproj
@@ -25,7 +25,7 @@
ex_CustomToolbar
- com.companyname.excustomtoolbar
+ fr.uca.iut.excustomtoolbar
1.0