-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page-based navigation system #10557
Comments
In the future we might want to support a special Page - mix of MasterDetailPage and TabbedPage specialized on the items source. Similarly how NavigationView works. And this would allow us to implement all-in one NavigationView-like control as an alternative to xamarin Shell control, which isn't compatible with Pages. |
|
Is there any plan for the work done in this to be integrated with the already existing ReactiveUI routing or is this going to be a complete replacement for that system? |
We have a policy to not depend on 3rd party MVVM frameworks. Avalonia should be 100% usable without an MVVM framework. |
Note, it could be possible in the other way around. I.e. make ReactiveUI suppose new avalonia types. Keeping implementations separated in Avalonia.ReactiveUI. As a reference https://github.com/reactiveui/ReactiveUI/blob/de86956daac9efcb20fabc7cc4ef3a438d0450d2/src/ReactiveUI.Maui/ReactiveMasterDetailPage.cs#L16 https://github.com/reactiveui/ReactiveUI.Samples/blob/main/Xamarin/MasterDetail/MasterDetail/MainPage.xaml |
Please keep view caching configuration in mind for either this feature or the docs. If not built-in, the user needs to find a "seam" to manage a cache within and it might not be obvious where. eg. The |
I like the design, however I have 1 question. Does the API trigger some load/unload (dispose) event on content pages? |
Wont OnAttachedToVisualTree/OnDetachedFromVisualTree be sufficient? |
yes it should sufficient. But I think it would be nice to have wrappers for this in such an API. |
Loaded/Unloaded as well.
What kind of wrappers? Normally, these events are control's lifetime is managed. |
OK, I will try to replace ReactiveUIs router in one of my POCs and give more feedback when done |
I'll point out that MvvmDialogs has a similar navigation system built-in It doesn't provide all the features listed above, but handles navigation and back button automatically.
And it provides Load/Closed events to the ViewModel automatically. |
Note that "master" is now considered a bad word in the USA. Xamarin.Forms has therefore renamed the Please also consider page transitions. There may be different animations when a new page is pushed/popped. IMHO a string Title does make sense when you show it in a navigation tree or tab name. But in the title bar people also need to show buttons or other elements right (and sometimes even left!) of the page title. So additional anchors where people can add their content would be needed (e.g. PART_TitleBarLeft, PART_TitleBarRight). |
I'm realizing that there is no TabbedPage or swipe controls whatsoever in Avalonia, which makes it hard to develop any real mobile app! Any development on this? |
There is avalonia.inside, that has tabbed windows, another one or two i
have not evaluated .
but I would look at
https://github.com/AvaloniaInside/Shell <-- i havent tried this and not
sure if its being used , check the branches.
there are pinch features in the samples but i dont know how responsive they
are.
https://github.com/wieslawsoltes/Dock
This brings up a wider issue. i'm getting the chatbot to organise it..
.but I think Avalonia from WPF, like Monogame from XNA, the first and
oldest replacement for a killed Microsoft project ,are too old to die.
Silverlgiht was both WPF and XNA, it finally (years too late) went to open
source it was killed but many companies could not abandon it. So if you
want 3 desktop OS, linux, windows, osx, phones ,and Web and c#..touch and
then mabe voice and LLMs, ( this rapidly moving ito UI, with Phi and
semantic kernel and the accessibility can drive it for people who
aren't blind, i'm going blind and rather talk and listen to my pc ) ,
either way ive decided then Avalonia has the WPF successor spot. Forms
still is more popular again , too old to lie and legacy business with
steady cash flow, is much of industry. but being able to support different
aspect ratios and UI as declarative design intent is the best.
there are a lot of choices and i think ill just suggest how to fix the
pieces. besides Angle, there are several codes for 3d renders and they
include traspiling and all the same platforms. These hopefully can be
maintained but the maintainers of the above are extremely busy.. if someone
can update them. or find some and simplify them. If they went in as
samples. not a core PR i think would be best. Too many people doing the
exact same thing and its better to just share ..Small frameworks are
getting all the flux now. . Unity , and Godot and even Stride are too
bloated, but Stride has something to look at.. its now using Avalonia for
its IDE..
…On Mon, Jan 15, 2024 at 9:48 AM Etienne Charland ***@***.***> wrote:
I'm realizing that there is no TabbedPage or swipe controls whatsoever in
Avalonia, which makes it hard to develop any real mobile app!
Any development on this?
—
Reply to this email directly, view it on GitHub
<#10557 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD74XGKMOH3SEIHUSIR4XVLYOVFTNAVCNFSM6AAAAAAVPZSM7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJSGQYTENBSGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You're very right. Because the mobile for Avalonia is quite new it seems that there are just aren't the controls that are necessary to build mobile apps yet. This is why uno built their own toolkit which has navigation/shell/tabs and other bits built in. At the very least I need a listbox drag left and right to remove etc... I'm sure there are many other things that are required. |
Since we are in need of a mobile-first navigation system and currently lack resources and imagination
to design our own one, the proposal is to use Page-based navigation like Xamarin.Forms which is
already familiar to people doing mobile apps.
So this spec aims to provide a familiar API while adding some MVVM-friendliness that Xamarin.Forms lacks.
Xamarin.Forms Shell's counterpart is out of the scope of this spec.
Overview
The basic element of the navigation system is a
Page
. There can be only one "active" page, which is theinner-most page of the navigation system:
Each navigation page that has children only has at most one active child towards which it forwards any platform information and
asks it for the desired titlebar color or window state.
Any platform events like system Back button being pressed are sent to the innermost active page.
Since the active page has nothing to do with the input focus, the page host is required to traverse the tree to find the element to use as the
RoutedEvent
's source.View location
To make the system more MVVM-friendly, we are using
object
instead ofPage
.To convert an
object
to a page, we should do the following:Control
, we are using our standard IDataTemplate lookup mechanism and convert it into aControl
IDataTemplate
-produced control is not aPage
, wrap it into aContentPage
PageNavigationHost
This control acts as the page system host and is supposed to be used as
ISingleViewApplicationLifetime.MainView
or asWindow.Content
This is the only control in this spec that would be communicating with
TopLevel
'sIInsetsManager
directly.The only property is
Page
which is the root page of the app's navigation system.Page
The base class for more specialized pages. It's not supposed to be used directly by the user code.
ContentPage
This class is supposed to serve for used-defined content mostly acts in the same way as a
UserControl
, but can manageSafeAreaPadding
automaticallyContentPage
usesAutomaticallyApplySafeAreaPadding
,Padding
andSafeAreaPadding
properties to determine thePadding
ofPART_ContentPresenter
.MultiPage
This is a base class for pages that can have multiple child pages
NavigationPage
This
Page
maintains a navigation stack.SelectingMultiPage
This is a base class for
MultiPage
s that can have user-initiated selectionCarouselPage
A page that users can swipe from side to side to display pages of content, like a gallery.
TabbedPage
A page that displays an array of tabs across the top of the screen, each of which loads content onto the screen.
This page should be using child Page's
Title
andIcon
properties for the tab itemsMasterDetailPage
A page that manages two panes of information: A master page that presents data at a high level, and a detail page that displays low-level details about information in the master.
This should be implemented using our SplitView.
System Back button handling
When Android's back button is pressed, it should be intercepted by
PageNavigationHost
and raised as
PageNavigationSystemBackButtonPressed
routed event on the inner-most activePage
.NavigationPage
should mark it asHandled
ifHasBackButton == true
andit has successfully popped the active page from the navigation stack
The text was updated successfully, but these errors were encountered: