Skip to main content

INavigation Interface

Definition

Assembly:Avalonia.Controls
Package:Avalonia

Provides navigation operations for stack-based and modal page navigation. Exposed via Avalonia.Controls.Page.Navigation when a page is hosted in a NavigationPage.

public interface INavigation

Methods

NameDescription
InsertPageInserts page immediately before before in the stack. Does not change the currently visible page.
PopAllModalsAsync (2 overloads)Pops all modal pages, animating only the topmost dismissal.
PopAsync (2 overloads)Pops the top page using the host's default transition.
PopModalAsync (2 overloads)Pops the top modal page using the host's modal transition.
PopToPageAsync (2 overloads)Pops all pages above page using the host's default transition.
PopToRootAsync (2 overloads)Pops all pages above the root using the host's default transition.
PushAsync (2 overloads)Pushes page using the host's default transition.
PushModalAsync (2 overloads)Pushes page as a modal using the host's modal transition.
RemovePageRemoves page from the navigation stack without animation.
ReplaceAsync (2 overloads)Replaces the current top page with page using the host's default transition.

InsertPage Method

Inserts page immediately before before in the stack. Does not change the currently visible page.

public void InsertPage(Avalonia.Controls.Page page, Avalonia.Controls.Page before)

Parameters

page Avalonia.Controls.Page

before Avalonia.Controls.Page

PopAllModalsAsync overloads

PopAllModalsAsync Method

Pops all modal pages, animating only the topmost dismissal.

public System.Threading.Tasks.Task PopAllModalsAsync()
Returns

System.Threading.Tasks.Task

PopAllModalsAsync Method

Pops all modal pages using transition. Pass for no animation.

public System.Threading.Tasks.Task PopAllModalsAsync(Avalonia.Animation.IPageTransition transition)
Parameters

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

PopAsync overloads

PopAsync Method

Pops the top page using the host's default transition.

public System.Threading.Tasks.Task<Avalonia.Controls.Page> PopAsync()
Returns

System.Threading.Tasks.Task<Avalonia.Controls.Page>

PopAsync Method

Pops the top page using transition. Pass for no animation.

public System.Threading.Tasks.Task<Avalonia.Controls.Page> PopAsync(Avalonia.Animation.IPageTransition transition)
Parameters

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task<Avalonia.Controls.Page>

PopModalAsync overloads

PopModalAsync Method

Pops the top modal page using the host's modal transition.

public System.Threading.Tasks.Task<Avalonia.Controls.Page> PopModalAsync()
Returns

System.Threading.Tasks.Task<Avalonia.Controls.Page>

PopModalAsync Method

Pops the top modal page using transition. Pass for no animation.

public System.Threading.Tasks.Task<Avalonia.Controls.Page> PopModalAsync(Avalonia.Animation.IPageTransition transition)
Parameters

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task<Avalonia.Controls.Page>

PopToPageAsync overloads

PopToPageAsync Method

Pops all pages above page using the host's default transition.

public System.Threading.Tasks.Task PopToPageAsync(Avalonia.Controls.Page page)
Parameters

page Avalonia.Controls.Page

Returns

System.Threading.Tasks.Task

PopToPageAsync Method

Pops all pages above page using transition. Pass for no animation.

public System.Threading.Tasks.Task PopToPageAsync(Avalonia.Controls.Page page, Avalonia.Animation.IPageTransition transition)
Parameters

page Avalonia.Controls.Page

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

PopToRootAsync overloads

PopToRootAsync Method

Pops all pages above the root using the host's default transition.

public System.Threading.Tasks.Task PopToRootAsync()
Returns

System.Threading.Tasks.Task

PopToRootAsync Method

Pops all pages above the root using transition. Pass for no animation.

public System.Threading.Tasks.Task PopToRootAsync(Avalonia.Animation.IPageTransition transition)
Parameters

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

PushAsync overloads

PushAsync Method

Pushes page using the host's default transition.

public System.Threading.Tasks.Task PushAsync(Avalonia.Controls.Page page)
Parameters

page Avalonia.Controls.Page

Returns

System.Threading.Tasks.Task

PushAsync Method

Pushes page using transition. Pass for no animation.

public System.Threading.Tasks.Task PushAsync(Avalonia.Controls.Page page, Avalonia.Animation.IPageTransition transition)
Parameters

page Avalonia.Controls.Page

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

PushModalAsync overloads

PushModalAsync Method

Pushes page as a modal using the host's modal transition.

public System.Threading.Tasks.Task PushModalAsync(Avalonia.Controls.Page page)
Parameters

page Avalonia.Controls.Page

Returns

System.Threading.Tasks.Task

PushModalAsync Method

Pushes page as a modal using transition. Pass for no animation.

public System.Threading.Tasks.Task PushModalAsync(Avalonia.Controls.Page page, Avalonia.Animation.IPageTransition transition)
Parameters

page Avalonia.Controls.Page

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

RemovePage Method

Removes page from the navigation stack without animation.

public void RemovePage(Avalonia.Controls.Page page)

Parameters

page Avalonia.Controls.Page

ReplaceAsync overloads

ReplaceAsync Method

Replaces the current top page with page using the host's default transition.

public System.Threading.Tasks.Task ReplaceAsync(Avalonia.Controls.Page page)
Parameters

page Avalonia.Controls.Page

Returns

System.Threading.Tasks.Task

ReplaceAsync Method

Replaces the current top page with page using transition. Pass for no animation.

public System.Threading.Tasks.Task ReplaceAsync(Avalonia.Controls.Page page, Avalonia.Animation.IPageTransition transition)
Parameters

page Avalonia.Controls.Page

transition Avalonia.Animation.IPageTransition

Returns

System.Threading.Tasks.Task

Properties

NameDescription
CanGoBackGets whether a pop operation is possible (stack has more than one entry).
ModalStackGets the current modal stack. Index 0 is the oldest (bottom-most) modal; the last index is the most recently pushed (topmost) modal.
NavigationStackGets the current navigation stack. The root page is at index 0; the visible page is last.
StackDepthGets the number of pages in the navigation stack.

CanGoBack Property

Gets whether a pop operation is possible (stack has more than one entry).

public bool CanGoBack { get; set; }

ModalStack Property

Gets the current modal stack. Index 0 is the oldest (bottom-most) modal; the last index is the most recently pushed (topmost) modal.

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Page> ModalStack { get; set; }

Gets the current navigation stack. The root page is at index 0; the visible page is last.

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Page> NavigationStack { get; set; }

StackDepth Property

Gets the number of pages in the navigation stack.

public int StackDepth { get; set; }