![]() |
VOOZH | about |
dotnet add package Sextant.XamForms --version 2.12.162
NuGet\Install-Package Sextant.XamForms -Version 2.12.162
<PackageReference Include="Sextant.XamForms" Version="2.12.162" />
<PackageVersion Include="Sextant.XamForms" Version="2.12.162" />Directory.Packages.props
<PackageReference Include="Sextant.XamForms" />Project file
paket add Sextant.XamForms --version 2.12.162
#r "nuget: Sextant.XamForms, 2.12.162"
#:package Sextant.XamForms@2.12.162
#addin nuget:?package=Sextant.XamForms&version=2.12.162Install as a Cake Addin
#tool nuget:?package=Sextant.XamForms&version=2.12.162Install as a Cake Tool
👁 NuGet Stats
👁 Build
👁 Code Coverage
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
<p align="left"><img src="https://github.com/reactiveui/styleguide/blob/master/logo_sextant/vertical.png?raw=true" alt="Sextant" height="180px"></p>
Sextant was born from a fork of Xamvvm which is nice and simple MVVM Framework with a good navigation system. The problem is, I just wanted a simple navigation system to use with ReactiveUI without all the things that come along an MVVM framework. Plus, I wanted to make it more "Reactive Friendly".
Then a wild Rodney Littles appears, and with him an implementation of this AMAZING POST by Kent
Sextant is in a very initial stage and in constant change, so please be pantience with use... because we will break things.
This library is nothing more than me "standing on the shoulders of giants": Kent for been the original and true creator of this, I pretty much just copied and pasted it 😃 Geoffrey Huntley maintainer on ReactiveUI.
Install the nuget package on your Forms project and ViewModels project.
Pre release packages are available at https://nuget.pkg.github.com/reactiveui/index.json
| Platform | Sextant Package | NuGet |
|---|---|---|
| UWP | Sextant | 👁 CoreBadge |
| Xamarin.Forms | Sextant.XamForms | 👁 XamBadge |
| Xamarin.Forms | Sextant.Plugins.Popup | 👁 PopupBadge |
| Xamarin.iOS | Sextant | 👁 CoreBadge |
| Avalonia | Sextant.Avalonia | 👁 CoreBadge |
Version 2.0 added new extensions methods for the IMutableDepedencyResolver that allow you to register an IViewFor to a View Model.
Locator
.CurrentMutable
.RegisterNavigationView(() => new NavigationView(RxApp.MainThreadScheduler, RxApp.TaskpoolScheduler, ViewLocator.Current))
.RegisterParameterViewStackService()
.RegisterViewForNavigation(() => new PassPage(), () => new PassViewModel())
.RegisterViewForNavigation(() => new ReceivedPage(), () => new ReceivedViewModel());
Set the initial page:
Locator
.Current
.GetService<IParameterViewStackService>()
.PushPage<PassViewModel>()
.Subscribe();
MainPage = Locator.Current.GetNavigationView("NavigationView");
After that all you have to do is call one of the methods inside your ViewModels:
/// <summary>
/// Pops the <see cref="IPageViewModel"/> off the stack.
/// </summary>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PopModal(bool animate = true);
/// <summary>
/// Pops the <see cref="IPageViewModel"/> off the stack.
/// </summary>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PopPage(bool animate = true);
/// <summary>
/// Pushes the <see cref="IPageViewModel"/> onto the stack.
/// </summary>
/// <param name="modal">The modal.</param>
/// <param name="contract">The contract.</param>
/// <returns></returns>
IObservable<Unit> PushModal(IPageViewModel modal, string contract = null);
/// <summary>
/// Pushes the <see cref="IPageViewModel"/> onto the stack.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="contract">The contract.</param>
/// <param name="resetStack">if set to <c>true</c> [reset stack].</param>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PushPage(IPageViewModel page, string contract = null, bool resetStack = false, bool animate = true);
public class ViewModel
{
private readonly IViewStackServicen _viewStackService; // or IParameterViewStackServicen
public ViewModel(IViewStackServicen viewStackService)
{
_viewStackService = viewStackService;
OpenModal = ReactiveCommand
// FirstModalViewModel must implement IViewModel or INavigable
.CreateFromObservable(() => viewStackService.PushModal<FirstModalViewModel>(),
outputScheduler: RxApp.MainThreadScheduler);
}
public ReactiveCommand<Unit, Unit> OpenModal { get; }
}
Version 2.0 added support for passing parameters when navigating.
public class ViewModel
{
private readonly IParameterViewStackServicen _viewStackService;
public ViewModel(IParameterViewStackServicen viewStackService)
{
_viewStackService = viewStackService;
Navigate = ReactiveCommand
// NavigableViewModel must implement INavigable
.CreateFromObservable(() => viewStackService.PushModal<NavigableViewModel>(new NavigationParameter { { "parameter", parameter } }),
outputScheduler: RxApp.MainThreadScheduler);
}
public ReactiveCommand<Unit, Unit> Navigate { get; }
}
The INavigable interface exposes view model lifecycle methods that can be subscribed to. These methods unbox your parameter object. Implementing the interface allows you to assign values to the View Model during Navigation.
public class NavigableViewModel : INavigable
{
public string? _parameter;
public IObservable<Unit> WhenNavigatedFrom(INavigationParameter parameter)
{
return Observable.Return(Unit.Default)
}
public IObservable<Unit> WhenNavigatedTo(INavigationParameter parameter)
{
parameter.TryGetValue("parameter", out _parameter);
return Observable.Return(Unit.Default);
}
public IObservable<Unit> WhenNavigatingTo(INavigationParameter parameter)
{
return Observable.Return(Unit.Default);
}
}
Sextant is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. We ❤ the people who are involved in this project, and we’d love to have you on board, especially if you are just getting started or have never contributed to open-source before.
So here's to you, lovely person who wants to join us — this is how you can support us:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on Sextant.XamForms:
| Package | Downloads |
|---|---|
|
Pradana.ReactiveUI.XamForms
Opiniated Commons Library For ReactiveUI.XamForms |
Showing the top 2 popular GitHub repositories that depend on Sextant.XamForms:
| Repository | Stars |
|---|---|
|
reactiveui/ReactiveUI.Samples
This repository contains ReactiveUI samples.
|
|
|
TheEightBot/Reactive-Examples
Samples App using the Reactive Extensions and Reactive UI
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.12.162 | 565 | 5/26/2024 |
| 2.12.120 | 641 | 1/25/2024 |
| 2.12.113 | 445 | 12/9/2023 |
| 2.12.112 | 291 | 12/9/2023 |
| 2.12.4 | 12,578 | 5/19/2021 |
| 2.12.3 | 552 | 5/18/2021 |
| 2.11.1 | 12,996 | 2/28/2021 |
| 2.10.1 | 7,779 | 1/22/2021 |
| 2.9.5 | 820 | 12/31/2020 |
| 2.9.4 | 698 | 12/28/2020 |
| 2.9.1 | 2,753 | 12/16/2020 |
| 2.8.1 | 1,017 | 11/5/2020 |
| 2.7.1 | 3,212 | 6/6/2020 |
| 2.6.1 | 831 | 5/8/2020 |
| 2.5.8 | 1,103 | 3/5/2020 |
| 2.5.1 | 1,193 | 1/6/2020 |
| 2.4.1 | 747 | 12/12/2019 |
| 2.3.9 | 776 | 12/5/2019 |
| 2.3.7 | 704 | 11/28/2019 |
| 2.3.1 | 735 | 11/21/2019 |