-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2409 from unoplatform/dev/erli/region-sample
fix: Remove unnecessary request segments from parent region in backstack
- Loading branch information
Showing
21 changed files
with
523 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/FourthData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions; | ||
|
||
public class FourthData | ||
{ | ||
public string Name { get; set; } | ||
} |
66 changes: 66 additions & 0 deletions
66
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsFirstPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<Page x:Class="TestHarness.Ext.Navigation.Apps.Regions.RegionsFirstPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:TestHarness.Ext.Navigation.Apps.Regions" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:uen="using:Uno.Extensions.Navigation.UI" | ||
xmlns:utu="using:Uno.Toolkit.UI" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
mc:Ignorable="d"> | ||
|
||
<Grid uen:Region.Attached="True"> | ||
|
||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition /> | ||
</Grid.RowDefinitions> | ||
|
||
<utu:NavigationBar Content="First Page" Style="{StaticResource MaterialNavigationBarStyle}"> | ||
<utu:NavigationBar.MainCommand> | ||
<AppBarButton uen:Navigation.Request="-" Foreground="{ThemeResource OnSurfaceInverseBrush}"> | ||
<AppBarButton.Icon> | ||
<BitmapIcon UriSource="ms-appx:///Assets/Images/back.png" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
</utu:NavigationBar.MainCommand> | ||
</utu:NavigationBar> | ||
|
||
<Grid Grid.Row="1" | ||
uen:Region.Attached="True" | ||
uen:Region.Navigator="Visibility"> | ||
<Grid uen:Region.Name="RegionsOne" Visibility="Collapsed"> | ||
<TextBlock HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
FontSize="24" | ||
Text="One" /> | ||
</Grid> | ||
<Grid uen:Region.Name="RegionsTwo" Visibility="Collapsed"> | ||
<TextBlock HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
FontSize="24" | ||
Text="Two" /> | ||
</Grid> | ||
<Grid uen:Region.Name="RegionsThree" Visibility="Collapsed"> | ||
<Frame uen:Region.Attached="True"> | ||
<StackPanel> | ||
<TextBlock HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
FontSize="24" | ||
Text="Three" /> | ||
</StackPanel> | ||
</Frame> | ||
</Grid> | ||
</Grid> | ||
<utu:TabBar Grid.Row="2" | ||
VerticalAlignment="Bottom" | ||
uen:Region.Attached="True"> | ||
<utu:TabBar.Items> | ||
<utu:TabBarItem uen:Region.Name="RegionsOne" Content="One" /> | ||
<utu:TabBarItem uen:Region.Name="RegionsTwo" Content="Two" /> | ||
<utu:TabBarItem uen:Region.Name="RegionsThree" Content="Three" /> | ||
</utu:TabBar.Items> | ||
</utu:TabBar> | ||
</Grid> | ||
</Page> |
9 changes: 9 additions & 0 deletions
9
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsFirstPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions; | ||
|
||
public sealed partial class RegionsFirstPage : Page | ||
{ | ||
public RegionsFirstPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsFourthPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Page x:Class="TestHarness.Ext.Navigation.Apps.Regions.RegionsFourthPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:TestHarness.Ext.Navigation.Apps.Regions" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:utu="using:Uno.Toolkit.UI" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
mc:Ignorable="d"> | ||
|
||
<Grid utu:SafeArea.Insets="VisibleBounds"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition /> | ||
</Grid.RowDefinitions> | ||
<utu:NavigationBar Content="Fourth Page"> | ||
<utu:NavigationBar.MainCommand> | ||
<AppBarButton> | ||
<AppBarButton.Icon> | ||
<BitmapIcon UriSource="ms-appx:///Assets/Images/back.png" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
</utu:NavigationBar.MainCommand> | ||
</utu:NavigationBar> | ||
<StackPanel Grid.Row="1" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<TextBlock Margin="8" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Text="{Binding FourthData.Name}" /> | ||
</StackPanel> | ||
|
||
</Grid> | ||
</Page> |
9 changes: 9 additions & 0 deletions
9
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsFourthPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions; | ||
|
||
public sealed partial class RegionsFourthPage : Page | ||
{ | ||
public RegionsFourthPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsFourthViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions; | ||
|
||
public class RegionsFourthViewModel (FourthData fourthData) | ||
{ | ||
public FourthData FourthData { get; set; } = fourthData; | ||
} |
49 changes: 49 additions & 0 deletions
49
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsHomePage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<Page x:Class="TestHarness.Ext.Navigation.Apps.Regions.RegionsHomePage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:TestHarness.Ext.Navigation.Apps.Regions" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:uen="using:Uno.Extensions.Navigation.UI" | ||
xmlns:utu="using:Uno.Toolkit.UI" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<muxc:NavigationView Grid.Row="1" | ||
uen:Region.Attached="True" | ||
IsBackButtonVisible="Collapsed" | ||
IsPaneOpen="True" | ||
IsSettingsVisible="False" | ||
OpenPaneLength="200" | ||
PaneDisplayMode="Auto"> | ||
<muxc:NavigationView.MenuItems> | ||
|
||
<muxc:NavigationViewItem uen:Region.Name="RegionsFirst" Content="First Page"> | ||
<muxc:NavigationViewItem.Icon> | ||
<SymbolIcon Symbol="Accept" /> | ||
</muxc:NavigationViewItem.Icon> | ||
</muxc:NavigationViewItem> | ||
|
||
<muxc:NavigationViewItem uen:Region.Name="RegionsSecond" Content="Second Page"> | ||
<muxc:NavigationViewItem.Icon> | ||
<SymbolIcon Symbol="Share" /> | ||
</muxc:NavigationViewItem.Icon> | ||
</muxc:NavigationViewItem> | ||
|
||
<muxc:NavigationViewItem uen:Region.Name="RegionsThird" Content="Third Page"> | ||
<muxc:NavigationViewItem.Icon> | ||
<SymbolIcon Symbol="OutlineStar" /> | ||
</muxc:NavigationViewItem.Icon> | ||
</muxc:NavigationViewItem> | ||
|
||
</muxc:NavigationView.MenuItems> | ||
|
||
<Grid x:Name="NavigationGrid" | ||
Grid.Column="1" | ||
uen:Region.Attached="True" | ||
uen:Region.Navigator="Visibility" /> | ||
</muxc:NavigationView> | ||
</Grid> | ||
</Page> |
10 changes: 10 additions & 0 deletions
10
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsHomePage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions | ||
{ | ||
public sealed partial class RegionsHomePage : Page | ||
{ | ||
public RegionsHomePage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsHostInit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace TestHarness.Ext.Navigation.Apps.Regions; | ||
|
||
public partial class RegionsHostInit : BaseHostInitialization | ||
{ | ||
protected override void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) | ||
{ | ||
views.Register( | ||
new ViewMap(ViewModel: typeof(RegionsShellModel)), | ||
new ViewMap<RegionsHomePage>(), | ||
new ViewMap<RegionsFirstPage>(), | ||
new ViewMap<RegionsSecondPage, RegionsSecondViewModel>(), | ||
new ViewMap<RegionsThirdPage>(), | ||
new DataViewMap<RegionsFourthPage, RegionsFourthViewModel, FourthData>() | ||
); | ||
|
||
routes.Register( | ||
new RouteMap("", View: views.FindByViewModel<RegionsShellModel>(), | ||
Nested: | ||
[ | ||
new ("RegionsHome", View: views.FindByView<RegionsHomePage>(), | ||
Nested: | ||
[ | ||
new ("RegionsFirst", View: views.FindByView<RegionsFirstPage>(), IsDefault: true, | ||
Nested: | ||
[ | ||
new ("RegionsOne", IsDefault: true), | ||
new ("RegionsTwo"), | ||
new ("RegionsThree") | ||
] | ||
), | ||
new ("RegionsSecond", View: views.FindByViewModel<RegionsSecondViewModel>()), | ||
new ("RegionsThird", View: views.FindByView<RegionsThirdPage>()), | ||
new ("RegionsFourth", View: views.FindByViewModel<RegionsFourthViewModel>(), DependsOn: "RegionsSecond") | ||
]), | ||
] | ||
) | ||
); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
testing/TestHarness/TestHarness/Ext/Navigation/Apps/Regions/RegionsMainPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<testharness:BaseTestSectionPage x:Class="TestHarness.Ext.Navigation.Apps.Regions.RegionsMainPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:TestHarness.Ext.Navigation.Apps.Regions" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:testharness="using:TestHarness" | ||
xmlns:uen="using:Uno.Extensions.Navigation.UI" | ||
xmlns:utu="using:Uno.Toolkit.UI" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<TextBlock Margin="20" | ||
FontSize="30" | ||
Text="Sample App: Regions Tests" /> | ||
<ScrollViewer Grid.Row="1" | ||
ScrollViewer.HorizontalScrollBarVisibility="Auto" | ||
ScrollViewer.HorizontalScrollMode="Auto" | ||
ScrollViewer.VerticalScrollBarVisibility="Disabled" | ||
ScrollViewer.VerticalScrollMode="Disabled"> | ||
<Border HorizontalAlignment="Left" | ||
VerticalAlignment="Stretch" | ||
BorderBrush="Black" | ||
BorderThickness="2"> | ||
|
||
<utu:ExtendedSplashScreen x:Name="NavigationRoot" | ||
Width="1920" | ||
HorizontalAlignment="Left" | ||
VerticalAlignment="Stretch" | ||
HorizontalContentAlignment="Stretch" | ||
VerticalContentAlignment="Stretch" | ||
AutomationProperties.AutomationId="NavigationRoot" /> | ||
</Border> | ||
</ScrollViewer> | ||
<StackPanel Grid.Row="2" | ||
HorizontalAlignment="Center" | ||
Orientation="Horizontal"> | ||
<Button AutomationProperties.AutomationId="ShowAppButton" | ||
Click="ShowAppClick" | ||
Content="Regions App" /> | ||
<Button AutomationProperties.AutomationId="NarrowButton" | ||
Click="NarrowClick" | ||
Content="Narrow" /> | ||
<Button AutomationProperties.AutomationId="WideButton" | ||
Click="WideClick" | ||
Content="Wide" /> | ||
</StackPanel> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup> | ||
<VisualState x:Name="NarrowWindow"> | ||
<VisualState.Setters> | ||
<Setter Target="NavigationRoot.Width" Value="400" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState x:Name="WideWindow" /> | ||
|
||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</Grid> | ||
</testharness:BaseTestSectionPage> |
Oops, something went wrong.