From 5a9abe71e37c9c2e53f0c9cde223dacb9992d074 Mon Sep 17 00:00:00 2001
From: Kunal Shah <37922021+Kunal22shah@users.noreply.github.com>
Date: Tue, 18 Jun 2024 19:24:22 -0400
Subject: [PATCH] chore: remove platform specific, native commandBar styles
(#1421)
(cherry picked from commit 9b440f00084218fa228ce60637e6b757e6c37309)
---
.../Styles/Controls/v2/CommandBar.xaml | 114 ++----------------
.../Controls/CommandBarSamplePage.xaml | 44 +++----
.../Controls/CommandBarSamplePage.xaml.cs | 11 +-
.../CommandBarSample_NestedPage1.xaml | 71 -----------
.../CommandBarSample_NestedPage1.xaml.cs | 59 ---------
.../CommandBarSample_NestedPage2.xaml | 42 -------
.../CommandBarSample_NestedPage2.xaml.cs | 11 --
...3MaterialCommandBarSample_NestedPage1.xaml | 70 -----------
...terialCommandBarSample_NestedPage1.xaml.cs | 59 ---------
...3MaterialCommandBarSample_NestedPage2.xaml | 41 -------
...terialCommandBarSample_NestedPage2.xaml.cs | 11 --
.../Uno.Themes.Samples.Shared.projitems | 28 -----
12 files changed, 26 insertions(+), 535 deletions(-)
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml.cs
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml.cs
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml.cs
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml
delete mode 100644 src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml.cs
diff --git a/src/library/Uno.Material/Styles/Controls/v2/CommandBar.xaml b/src/library/Uno.Material/Styles/Controls/v2/CommandBar.xaml
index 8165931e2..e93428580 100644
--- a/src/library/Uno.Material/Styles/Controls/v2/CommandBar.xaml
+++ b/src/library/Uno.Material/Styles/Controls/v2/CommandBar.xaml
@@ -9,9 +9,11 @@
xmlns:uuc="using:Uno.UI.Controls"
mc:Ignorable="android ios">
+
4
48
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+ BasedOn="{StaticResource MaterialBaseCommandBarStyle}" />
+
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml
index 6a4bf8354..5f154f8e3 100644
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml
+++ b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml
@@ -6,39 +6,32 @@
xmlns:sample="using:Uno.Themes.Samples"
xmlns:android="http:/uno.ui/android"
xmlns:ios="http:/uno.ui/ios"
+ xmlns:smtx="using:ShowMeTheXAML"
mc:Ignorable="d android ios"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -46,4 +39,3 @@
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml.cs b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml.cs
index 8180f0216..4a06ae75a 100644
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml.cs
+++ b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/Controls/CommandBarSamplePage.xaml.cs
@@ -1,4 +1,4 @@
-using Uno.Themes.Samples.Content.NestedSamples;
+using Uno.Themes.Samples.Content.NestedSamples;
namespace Uno.Themes.Samples.Content.Controls;
@@ -10,13 +10,4 @@ public CommandBarSamplePage()
{
this.InitializeComponent();
}
- private void ShowSampleInNestedFrame(object sender, RoutedEventArgs e)
- {
- Shell.GetForCurrentView()?.ShowNestedSample(clearStack: true);
- }
-
- private void ShowM3SampleInNestedFrame(object sender, RoutedEventArgs e)
- {
- Shell.GetForCurrentView()?.ShowNestedSample(clearStack: true);
- }
}
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml
deleted file mode 100644
index ffc22c9d2..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You can use the back button located on the left side of the CommandBar
- to exit this sample.
-
-
-
-
-
-
-
-
-
-
- note: In order for the `MaterialCommandBarStyle` to work properly on iOS and Android,
- you will need to present them using a `NativeDefaultFrame` in your MainPage/Shell. As shown below:
-
-
-
-
-
-
-
- note: In order to support native back navigations (uwp, browser, android),
- you will have to handle the SystemNavigationManager.BackRequested event. As shown below:
-
-
-
-
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml.cs b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml.cs
deleted file mode 100644
index 9b9091ce2..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage1.xaml.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-namespace Uno.Themes.Samples.Content.NestedSamples;
-
-public sealed partial class CommandBarSample_NestedPage1 : Page
-{
- public CommandBarSample_NestedPage1()
- {
- this.InitializeComponent();
-
- this.SeeCodeBehindButton.Content = GetCodeBehind();
- this.SeeAdditionSetupButton.Content = GetAdditionSetup();
- }
-
- private string GetCodeBehind()
- {
- return @"
-private void NavigateToNextPage(object sender, RoutedEventArgs e) =>
- Frame.Navigate(typeof(CommandBarSample_NestedPage2));
-
-private void NavigateBack(object sender, RoutedEventArgs e) =>
- Frame.GoBack();
-".Trim("\r\n".ToCharArray());
- }
-
- private string GetAdditionSetup()
- {
- return @"
-// in the MainPage or Shell:
-public MainPage()
-{
- this.InitializeComponent();
-
- SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
-}
-
-private void OnBackRequested(object sender, BackRequestedEventArgs e)
-{
- if (ContentFrame.CanGoBack)
- {
- ContentFrame.GoBack();
-
- // prevent default behaviors (android: back to home screen, browser: navigate back)
- // since we just handled in app.
- e.Handled = true;
- }
-}
-".Trim("\r\n".ToCharArray());
- }
-
- private void NavigateToNextPage(object sender, RoutedEventArgs e) =>
- Frame.Navigate(typeof(CommandBarSample_NestedPage2));
-
- private void NavigateBack(object sender, RoutedEventArgs e)
- {
- // Normally we would've just called `Frame.GoBack();` if we only have a single frame.
- // However, a nested frame is used to show-case fullscreen sample, so we need some
- // custom handling to hide the nested frame on back navigation when the stack is empty.
- Shell.GetForCurrentView()?.BackNavigateFromNestedSample();
- }
-}
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml
deleted file mode 100644
index fe4f534a2..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You can use the back button located on the left side of the CommandBar
- to navigate back.
-
-
-
-
-
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml.cs b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml.cs
deleted file mode 100644
index befed4902..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/CommandBarSample_NestedPage2.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Uno.Themes.Samples.Content.NestedSamples;
-
-public sealed partial class CommandBarSample_NestedPage2 : Page
-{
- public CommandBarSample_NestedPage2()
- {
- this.InitializeComponent();
- }
-
- private void NavigateBack(object sender, RoutedEventArgs e) => Frame.GoBack();
-}
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml
deleted file mode 100644
index 374b11532..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You can use the back button located on the left side of the CommandBar
- to exit this sample.
-
-
-
-
-
-
-
-
-
-
- note: In order for the `MaterialCommandBarStyle` to work properly on iOS and Android,
- you will need to present them using a `NativeDefaultFrame` in your MainPage/Shell. As shown below:
-
-
-
-
-
-
-
- note: In order to support native back navigations (uwp, browser, android),
- you will have to handle the SystemNavigationManager.BackRequested event. As shown below:
-
-
-
-
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml.cs b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml.cs
deleted file mode 100644
index 10a812476..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage1.xaml.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-namespace Uno.Themes.Samples.Content.NestedSamples;
-
-public sealed partial class M3MaterialCommandBarSample_NestedPage1 : Page
-{
- public M3MaterialCommandBarSample_NestedPage1()
- {
- this.InitializeComponent();
-
- this.SeeCodeBehindButton.Content = GetCodeBehind();
- this.SeeAdditionSetupButton.Content = GetAdditionSetup();
- }
-
- private string GetCodeBehind()
- {
- return @"
-private void NavigateToNextPage(object sender, RoutedEventArgs e) =>
- Frame.Navigate(typeof(CommandBarSample_NestedPage2));
-
-private void NavigateBack(object sender, RoutedEventArgs e) =>
- Frame.GoBack();
-".Trim("\r\n".ToCharArray());
- }
-
- private string GetAdditionSetup()
- {
- return @"
-// in the MainPage or Shell:
-public MainPage()
-{
- this.InitializeComponent();
-
- SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
-}
-
-private void OnBackRequested(object sender, BackRequestedEventArgs e)
-{
- if (ContentFrame.CanGoBack)
- {
- ContentFrame.GoBack();
-
- // prevent default behaviors (android: back to home screen, browser: navigate back)
- // since we just handled in app.
- e.Handled = true;
- }
-}
-".Trim("\r\n".ToCharArray());
- }
-
- private void NavigateToNextPage(object sender, RoutedEventArgs e) =>
- Frame.Navigate(typeof(M3MaterialCommandBarSample_NestedPage2));
-
- private void NavigateBack(object sender, RoutedEventArgs e)
- {
- // Normally we would've just called `Frame.GoBack();` if we only have a single frame.
- // However, a nested frame is used to show-case fullscreen sample, so we need some
- // custom handling to hide the nested frame on back navigation when the stack is empty.
- Shell.GetForCurrentView()?.BackNavigateFromNestedSample();
- }
-}
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml
deleted file mode 100644
index 4c07041a1..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You can use the back button located on the left side of the CommandBar
- to navigate back.
-
-
-
-
-
-
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml.cs b/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml.cs
deleted file mode 100644
index 58b77bd3a..000000000
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Content/NestedSamples/M3MaterialCommandBarSample_NestedPage2.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Uno.Themes.Samples.Content.NestedSamples;
-
-public sealed partial class M3MaterialCommandBarSample_NestedPage2 : Page
-{
- public M3MaterialCommandBarSample_NestedPage2()
- {
- this.InitializeComponent();
- }
-
- private void NavigateBack(object sender, RoutedEventArgs e) => Frame.GoBack();
-}
diff --git a/src/samples/UWP/Uno.Themes.Samples.Shared/Uno.Themes.Samples.Shared.projitems b/src/samples/UWP/Uno.Themes.Samples.Shared/Uno.Themes.Samples.Shared.projitems
index b67885b51..dc6be5309 100644
--- a/src/samples/UWP/Uno.Themes.Samples.Shared/Uno.Themes.Samples.Shared.projitems
+++ b/src/samples/UWP/Uno.Themes.Samples.Shared/Uno.Themes.Samples.Shared.projitems
@@ -109,18 +109,6 @@
ControlExtensionsSamplePage.xaml
-
- M3MaterialCommandBarSample_NestedPage1.xaml
-
-
- CommandBarSample_NestedPage1.xaml
-
-
- M3MaterialCommandBarSample_NestedPage2.xaml
-
-
- CommandBarSample_NestedPage2.xaml
-
MediaPlayerElementSample_NestedPage1.xaml
@@ -291,22 +279,6 @@
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile