From a081a87b4db39bf5e9d2f6f4bafa4c2bd3e745ee Mon Sep 17 00:00:00 2001 From: David Britch Date: Tue, 10 Oct 2023 10:25:43 +0100 Subject: [PATCH 1/2] AppThemeBinding supports DynamicResource values --- docs/user-interface/system-theme-changes.md | 25 ++++++++++++++++++++- docs/whats-new/dotnet-8.md | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/user-interface/system-theme-changes.md b/docs/user-interface/system-theme-changes.md index 11c71cdf9d..572398a2ba 100644 --- a/docs/user-interface/system-theme-changes.md +++ b/docs/user-interface/system-theme-changes.md @@ -53,7 +53,7 @@ The following XAML example shows how to use the [`AppThemeBinding`](xref:Microso In this example, the text color of the first is set to green when the device is using its light theme, and is set to red when the device is using its dark theme. Similarly, the displays a different image file based upon the current system theme. -In addition, resources defined in a can be consumed with the [`StaticResource`](xref:Microsoft.Maui.Controls.Xaml.StaticResourceExtension) markup extension: +Resources defined in a can be consumed in an [`AppThemeBinding`](xref:Microsoft.Maui.Controls.Xaml.AppThemeBindingExtension) with the [`StaticResource`](xref:Microsoft.Maui.Controls.Xaml.StaticResourceExtension) markup extension: ```xaml @@ -86,6 +86,29 @@ In addition, resources defined in a and the style changes based on whether the device is using its light theme or dark theme. +::: moniker range=">=net-maui-8.0" + +In addition, resources defined in a can also be consumed in an [`AppThemeBinding`](xref:Microsoft.Maui.Controls.Xaml.AppThemeBindingExtension) with the [`DynamicResource`](xref:Microsoft.Maui.Controls.Xaml.DynamicResourceExtension) markup extension: + +```xaml + + + DarkGray + HotPink + Yellow + + + +``` + +::: moniker-end + ### Extension methods .NET MAUI includes `SetAppThemeColor` and `SetAppTheme` extension methods that enable objects to respond to system theme changes. diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md index 304c9d5e88..40c8fbfbe1 100644 --- a/docs/whats-new/dotnet-8.md +++ b/docs/whats-new/dotnet-8.md @@ -24,6 +24,7 @@ For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/c - The position at which a drag or drop gesture occurred can be obtained by calling the `GetPosition` method on a , , or object. For more information, see [Recognize a drag and drop gesture](~/fundamentals/gestures/drag-and-drop.md). - gains a `UserAgent` property. For more information, see [WebView](~/user-interface/controls/webview.md). - Inline media playback of HTML5 video, including autoplay and picture in picture, has been enabled by default for the on iOS. For more information, see [Set media playback preferences on iOS and Mac Catalyst](~/user-interface/controls/webview.md#set-media-playback-preferences-on-ios-and-mac-catalyst). +- Reources defined in a can also be consumed in an [`AppThemeBinding`](xref:Microsoft.Maui.Controls.Xaml.AppThemeBindingExtension) with the [`DynamicResource`](xref:Microsoft.Maui.Controls.Xaml.DynamicResourceExtension) markup extension. The following types or members have been deprecated: From cd156602d3ad78e79bffdb475e446774992a79d5 Mon Sep 17 00:00:00 2001 From: David Britch Date: Tue, 10 Oct 2023 10:34:47 +0100 Subject: [PATCH 2/2] Edit. --- docs/whats-new/dotnet-8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md index 40c8fbfbe1..5be9bf5263 100644 --- a/docs/whats-new/dotnet-8.md +++ b/docs/whats-new/dotnet-8.md @@ -24,7 +24,7 @@ For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/c - The position at which a drag or drop gesture occurred can be obtained by calling the `GetPosition` method on a , , or object. For more information, see [Recognize a drag and drop gesture](~/fundamentals/gestures/drag-and-drop.md). - gains a `UserAgent` property. For more information, see [WebView](~/user-interface/controls/webview.md). - Inline media playback of HTML5 video, including autoplay and picture in picture, has been enabled by default for the on iOS. For more information, see [Set media playback preferences on iOS and Mac Catalyst](~/user-interface/controls/webview.md#set-media-playback-preferences-on-ios-and-mac-catalyst). -- Reources defined in a can also be consumed in an [`AppThemeBinding`](xref:Microsoft.Maui.Controls.Xaml.AppThemeBindingExtension) with the [`DynamicResource`](xref:Microsoft.Maui.Controls.Xaml.DynamicResourceExtension) markup extension. +- Reources defined in a can also be consumed in an [`AppThemeBinding`](xref:Microsoft.Maui.Controls.Xaml.AppThemeBindingExtension) with the [`DynamicResource`](xref:Microsoft.Maui.Controls.Xaml.DynamicResourceExtension) markup extension. For more information, see [Define and consume theme resources](~/user-interface/system-theme-changes.md#define-and-consume-theme-resources). The following types or members have been deprecated: