AvaloniaInside.Shell 1.3.0

dotnet add package AvaloniaInside.Shell --version 1.3.0                
NuGet\Install-Package AvaloniaInside.Shell -Version 1.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AvaloniaInside.Shell" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AvaloniaInside.Shell --version 1.3.0                
#r "nuget: AvaloniaInside.Shell, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AvaloniaInside.Shell as a Cake Addin
#addin nuget:?package=AvaloniaInside.Shell&version=1.3.0

// Install AvaloniaInside.Shell as a Cake Tool
#tool nuget:?package=AvaloniaInside.Shell&version=1.3.0                

image

<h1><img src="https://github.com/AvaloniaInside/Shell/assets/956077/6b34f130-0297-4530-ab0d-4074e92dae21" width="86" /> Shell</h1>

Avalonia Inside Shell reduces the complexity of mobile/desktop application development by providing the fundamental features that most applications require, including:

A single place to describe the visual hierarchy of an application.
A common navigation user experience.
A URI-based navigation scheme that permits navigation to any page in the application

We welcome feedback, suggestions, and contributions from anyone who is interested in this project. We appreciate your support and patience as we work towards releasing a stable version of this project.

Screenshots

<img src="https://user-images.githubusercontent.com/956077/226295190-cbe81c7d-4054-4c07-9e5c-7ee7149c1468.png" width="300"/> <img src="https://user-images.githubusercontent.com/956077/226295294-3d4f1f9e-941d-4248-b941-a0c35ca0533a.png" width="300"/>

Installation

To use AvaloniaInside.Shell in your Avalonia project, you can install the package via NuGet using the following command in the Package Manager Console:

dotnet add package AvaloniaInside.Shell --version 1.3.0

Alternatively, you can also install the package through Visual Studio's NuGet Package Manager.

Add dependencies to the Locator or call Program.cs

public static AppBuilder BuildAvaloniaApp()
	=> AppBuilder.Configure<App>()
		.UsePlatformDetect()
		.LogToTrace()
		.UseReactiveUI()
		.UseShell();

Add default theme or add your custom theme to the App.axmal file

<StyleInclude Source="avares://AvaloniaInside.Shell/Default.axaml"></StyleInclude>

Using Shell

Adding a ShellView

To use a ShellView in your application, you can add it to your XAML file like this:

<ShellView>
  
</ShellView>
Basic Usage Guide for Shell and Navigation

You can register navigation using the Host and Route elements. Host can be used to group pages under a common root, such as a TabControl. Here's an example:

<ShellView Name="MyShellView">
    <Host Path="main" Page="views:MainTabControl">
        <Route Path="home" Page="views:HomePage">
            <Route Path="confirmation" Page="views:SimpleDialog" Type="Modal"></Route>
        </Route>
        <Host Path="pets" Page="views:PetsTabControlView" Default="cat">
            <Route Path="cat" Page="views:CatView"></Route>
            <Route Path="dog" Page="views:DogView"></Route>
        </Host>
        <Route Path="product" Page="shopViews:ProductCatalogView">
            <Route Path="filter" Page="shopViews:ProductCatalogFilterView" Type="Modal"></Route>
        </Route>
        <Route Path="setting" Page="views:SettingView">
            <Route Path="profile" Page="views:ProfileView"></Route>
        </Route>
    </Host>
</ShellView>

And to navigate to a specific page, we can use the Navigator property of the ShellView, as follows:

await MyShellView.Navigator.NavigateAsync("/main/home/confirmation", cancellationToken);

image

Each page that is currently on top of the navigation stack has access to the navigation bar's title and navigation item. In hierarchical hosts, the currently selected item in the host will be the one that has access to the navigation bar. For example, in the case of /home/pets/cat, the page associated with the cat would be able to modify the navigation bar. This can be done by setting the NavigationBar.Header and NavigationBar.Item properties, as shown in the code snippet below:

<UserControl xmlns="https://github.com/avaloniaui"
             x:Class="ShellExample.Views.ShopViews.ProductCatalogView"
             NavigationBar.Header="Products">
	<NavigationBar.Item>
		<Button Content="Filter" Command="{Binding FilterCommand}"></Button>
	</NavigationBar.Item>
 ...
</UserControl>

ShellView content's support

IItem is the base interface for all items that can be added to the ShellView's content. It has the following properties:

Route

Route is a type of IItem that represents a navigation route in the ShellView. It has a Page property that specifies the view associated with the route, as well as an optional Type property that specifies the navigation type, And Path is the property to register navigate.

Host

Host can be used to group pages under a common root, such as a TabControl. It has a Page property that specifies the view associated with the host, as well as an optional Default property that specifies the default child route. as well as a Children property that specifies any child Route objects.

SideMenuItem

SideMenuItem is another type of item that can be used to display navigation options in the ShellView's side menu. It also inherits from IItem and has the following properties:

Icon: An icon to display next to the item's label in the side menu. Title: The text label to display for the item in the side menu. Path: The path of navigation.

Example of Side Menu usage

side-menu

<UserControl xmlns="https://github.com/avaloniaui" ...>

    <ShellView Name="ShellViewMain" DefaultRoute="/main">
        <Host Path="main" Page="views:MainTabControl"> ... </Host>

        
        <ShellView.SideMenuHeader>
		<widgets:UserProfileWidgetView></widgets:UserProfileWidgetView>
	</ShellView.SideMenuHeader>

        
        <SideMenuItem Path="/main/home" Title="Home" Icon="/Assets/Icons/house-solid.png"></SideMenuItem>
        <SideMenuItem Path="/main/pets/cat" Title="Cat" Icon="/Assets/Icons/cat-solid.png"></SideMenuItem>
        <SideMenuItem Path="/main/pets/dog" Title="Dog" Icon="/Assets/Icons/dog-solid.png"></SideMenuItem>
        <SideMenuItem Path="/main/product" Title="Products" Icon="/Assets/Icons/tag-solid.png"></SideMenuItem>
        <SideMenuItem Path="/main/setting" Title="Settings" Icon="/Assets/Icons/user-solid.png"></SideMenuItem>
        <SideMenuItem Path="/second" Title="Second Click" Icon="/Assets/Icons/check-solid.png"></SideMenuItem>

        
        <ShellView.SideMenuContents>
		<widgets:WeatherView Margin="0, 20, 0, 0" />
		<widgets:CalendarWidgetView Margin="0, 20, 0, 0" />
	</ShellView.SideMenuContents>

        
	<ShellView.SideMenuFooter>
		<Border Background="#11000000" Height="25">
			<TextBlock Text="AvaloniaInside Shell 2023"
				   FontWeight="Light"
				   VerticalAlignment="Center"
				   HorizontalAlignment="Center">
			</TextBlock>
		</Border>
	</ShellView.SideMenuFooter>
    </ShellView>
</UserControl>

In the code above side menu will contains 6 navigate route and will link selected item to the current route.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 97 12/21/2024
1.2.0 742 8/23/2024
1.1.3 719 4/5/2024
1.1.2 816 12/10/2023
1.1.1 173 12/4/2023
1.1.0 562 9/16/2023
1.0.0 259 7/8/2023
0.1.2.1 183 6/3/2023
0.1.2-alpha 133 5/8/2023
0.1.1-alpha 159 3/23/2023
0.1.0-alpha 163 3/20/2023