From b228b16c18f31579da2ff8c3333852c5e1e95aea Mon Sep 17 00:00:00 2001 From: David Oliver Date: Thu, 1 Oct 2020 06:46:18 -0400 Subject: [PATCH] feat: Add one-line method to set native frame navigation styles --- src/Uno.UI/FeatureConfiguration.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Uno.UI/FeatureConfiguration.cs b/src/Uno.UI/FeatureConfiguration.cs index 0da993c72d23..49886914015c 100644 --- a/src/Uno.UI/FeatureConfiguration.cs +++ b/src/Uno.UI/FeatureConfiguration.cs @@ -271,6 +271,8 @@ public static class Style /// /// Determines if Uno.UI should be using native styles for controls that have /// a native counterpart. (e.g. Button, Slider, ComboBox, ...) + /// + /// By default this is true. /// public static bool UseUWPDefaultStyles { get; set; } = true; @@ -283,6 +285,28 @@ public static class Style /// appearance/comportment for a few particular controls, or vice versa. /// public static IDictionary UseUWPDefaultStylesOverride { get; } = new Dictionary(); + + /// + /// This enables native frame navigation on Android and iOS by setting related classes (, + /// and ) to use their native styles. + /// + public static void ConfigureNativeFrameNavigation() + { + SetUWPDefaultStylesOverride(useUWPDefaultStyle: false); + SetUWPDefaultStylesOverride(useUWPDefaultStyle: false); + SetUWPDefaultStylesOverride(useUWPDefaultStyle: false); + } + + /// + /// Override the native styles useage for control type . + /// + /// + /// + /// Whether instances of should use the UWP default style. + /// If false, the native default style (if one exists) will be used. + /// + public static void SetUWPDefaultStylesOverride(bool useUWPDefaultStyle) where TControl : Windows.UI.Xaml.Controls.Control + => UseUWPDefaultStylesOverride[typeof(TControl)] = useUWPDefaultStyle; } public static class TextBlock