Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
353 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\src\Forms\Prism.Forms.Regions\Prism.Forms.Regions.csproj" /> | ||
<ProjectReference Include="..\..\..\..\src\Forms\Prism.Forms\Prism.Forms.csproj" /> | ||
<ProjectReference Include="..\..\..\..\src\Prism.Core\Prism.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,24 @@ | ||
using System; | ||
using HelloRegions.ViewModels; | ||
using HelloRegions.Views; | ||
using Prism.Ioc; | ||
using Prism.Modularity; | ||
|
||
namespace HelloRegions | ||
{ | ||
public class RegionDemoModule : IModule | ||
{ | ||
public void OnInitialized(IContainerProvider containerProvider) | ||
{ | ||
|
||
} | ||
|
||
public void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
containerRegistry.RegisterForNavigation<RegionDemoPage, RegionDemoPageViewModel>(); | ||
containerRegistry.RegisterForNavigation<RegionA, RegionAViewModel>(); | ||
containerRegistry.RegisterForNavigation<RegionB, RegionBViewModel>(); | ||
containerRegistry.RegisterForNavigation<RegionC, RegionCViewModel>(); | ||
} | ||
} | ||
} |
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 HelloRegions.ViewModels | ||
{ | ||
public class RegionAViewModel : ViewModelBase | ||
{ | ||
public RegionAViewModel() | ||
{ | ||
Title = "Hello from Region A"; | ||
} | ||
} | ||
} |
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 HelloRegions.ViewModels | ||
{ | ||
public class RegionBViewModel : ViewModelBase | ||
{ | ||
public RegionBViewModel() | ||
{ | ||
Title = "Hello from Region B"; | ||
} | ||
} | ||
} |
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 HelloRegions.ViewModels | ||
{ | ||
public class RegionCViewModel : ViewModelBase | ||
{ | ||
public RegionCViewModel() | ||
{ | ||
Title = "Hello from Region C"; | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
e2e/Forms/src/HelloRegions/ViewModels/RegionDemoPageViewModel.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,31 @@ | ||
using System; | ||
using Prism.Commands; | ||
using Prism.Mvvm; | ||
using Prism.Regions; | ||
using Prism.Regions.Navigation; | ||
|
||
namespace HelloRegions.ViewModels | ||
{ | ||
public class RegionDemoPageViewModel : BindableBase | ||
{ | ||
private IRegionManager _regionManager { get; } | ||
|
||
public RegionDemoPageViewModel(IRegionManager regionManager) | ||
{ | ||
_regionManager = regionManager; | ||
NavigateCommand = new DelegateCommand<string>(Navigate); | ||
} | ||
|
||
public DelegateCommand<string> NavigateCommand { get; } | ||
|
||
private void Navigate(string target) | ||
{ | ||
_regionManager.RequestNavigate("ContentRegion", target, NavigationCallback); | ||
} | ||
|
||
private void NavigationCallback(IRegionNavigationResult obj) | ||
{ | ||
|
||
} | ||
} | ||
} |
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,33 @@ | ||
using Prism.Mvvm; | ||
using Prism.Regions.Navigation; | ||
|
||
namespace HelloRegions.ViewModels | ||
{ | ||
public class ViewModelBase : BindableBase, IRegionAware | ||
{ | ||
public string Title { get; set; } | ||
|
||
private string _message; | ||
public string Message | ||
{ | ||
get => _message; | ||
set => SetProperty(ref _message, value); | ||
} | ||
|
||
public bool IsNavigationTarget(INavigationContext navigationContext) => | ||
false; | ||
|
||
public void OnNavigatedFrom(INavigationContext navigationContext) | ||
{ | ||
|
||
} | ||
|
||
public void OnNavigatedTo(INavigationContext navigationContext) | ||
{ | ||
if (navigationContext.Parameters.ContainsKey("message")) | ||
Message = navigationContext.Parameters.GetValue<string>("message"); | ||
else | ||
Message = "No Message provided..."; | ||
} | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="HelloRegions.Views.RegionA"> | ||
<Label Text="Hello from Region A" /> | ||
<Label Text="{Binding Message}" /> | ||
</StackLayout> |
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 HelloRegions.Views | ||
{ | ||
public partial class RegionA | ||
{ | ||
public RegionA() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="HelloRegions.Views.RegionB"> | ||
<Label Text="Hello from Region B" /> | ||
<Label Text="{Binding Message}" /> | ||
</StackLayout> |
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 HelloRegions.Views | ||
{ | ||
public partial class RegionB | ||
{ | ||
public RegionB() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="HelloRegions.Views.RegionC"> | ||
<Label Text="Hello from Region C" /> | ||
<Label Text="{Binding Message}" /> | ||
</StackLayout> |
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 HelloRegions.Views | ||
{ | ||
public partial class RegionC | ||
{ | ||
public RegionC() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:prism="http://prismlibrary.com" | ||
mc:Ignorable="d" | ||
x:Class="HelloRegions.Views.RegionDemoPage"> | ||
<StackLayout> | ||
<Label Text="ContentView - ContentRegion" /> | ||
<ContentView prism:RegionManager.RegionName="ContentRegion" /> | ||
<Button Text="Region A" | ||
Command="{Binding NavigateCommand}" | ||
CommandParameter="RegionA" /> | ||
<Button Text="Region B" | ||
Command="{Binding NavigateCommand}" | ||
CommandParameter="RegionB" /> | ||
<Button Text="Region C" | ||
Command="{Binding NavigateCommand}" | ||
CommandParameter="RegionC" /> | ||
</StackLayout> | ||
</ContentPage> |
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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xamarin.Forms; | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace HelloRegions.Views | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class RegionDemoPage : ContentPage | ||
{ | ||
public RegionDemoPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.