From c23d4ff5b81d256a9edabcb5c7992f5eb47abdea Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Tue, 21 Mar 2023 14:47:40 +1100 Subject: [PATCH] feat: Adjusting background brush for specified theme (cherry picked from commit 5017a58b0fab47a7ab966de17dd15ae4a47514a3) --- .../.template.config/template.json | 22 +++++++++++++++++++ .../Presentation/MainPage.xaml | 2 +- .../Presentation/SecondPage.xaml | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Uno.Extensions.Templates/content/unoapp-extensions/.template.config/template.json b/src/Uno.Extensions.Templates/content/unoapp-extensions/.template.config/template.json index 8939de5466..6be7f55ef2 100644 --- a/src/Uno.Extensions.Templates/content/unoapp-extensions/.template.config/template.json +++ b/src/Uno.Extensions.Templates/content/unoapp-extensions/.template.config/template.json @@ -525,6 +525,28 @@ "datatype": "bool", "value": "(appTheme == 'cupertino')" }, + "themeBackgroundBrush":{ + "type": "generated", + "generator": "switch", + "replaces": "$themeBackgroundBrush$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(appThemeEvaluator == 'material')", + "value": "BackgroundBrush" + }, + { + "condition": "(appThemeEvaluator == 'fluent')", + "value": "ApplicationPageBackgroundThemeBrush" + }, + { + "condition": "(appTheme == 'cupertino')", + "value": "CupertinoSystemBackgroundBrush" + } + ] + } + }, "presetDependencyInjectionDefault": { "type": "generated", "generator": "switch", diff --git a/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/MainPage.xaml b/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/MainPage.xaml index 0a82594214..346e4ea76f 100644 --- a/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/MainPage.xaml +++ b/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/MainPage.xaml @@ -9,7 +9,7 @@ xmlns:utu="using:Uno.Toolkit.UI" xmlns:not_skia="http://schemas.microsoft.com/winfx/2006/xaml/presentation" NavigationCacheMode="Required" - Background="{ThemeResource BackgroundBrush}"> + Background="{ThemeResource $themeBackgroundBrush$}"> diff --git a/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/SecondPage.xaml b/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/SecondPage.xaml index 0d8118ed9e..5466c95c8d 100644 --- a/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/SecondPage.xaml +++ b/src/Uno.Extensions.Templates/content/unoapp-extensions/MyExtensionsApp.1/Presentation/SecondPage.xaml @@ -6,7 +6,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uen="using:Uno.Extensions.Navigation.UI" xmlns:utu="using:Uno.Toolkit.UI" - Background="{ThemeResource BackgroundBrush}"> + Background="{ThemeResource $themeBackgroundBrush$}">