# Lemon.ModuleNavigation **Repository Path**: blacksunnyboy/Lemon.ModuleNavigation ## Basic Information - **Project Name**: Lemon.ModuleNavigation - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-01-23 - **Last Updated**: 2025-01-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Lemon.ModuleNavigation

[![NuGet](https://img.shields.io/nuget/v/Lemon.ModuleNavigation.svg?style=flat-square&label=NuGet)](https://www.nuget.org/packages/Lemon.ModuleNavigation/) ## Language - [English](#english) - [中文](#中文) --- ### English ## Introduction ### Lemon.ModuleNavigation A lightweight module navigation framework built on top of the Microsoft Dependency Injection (MSDI) for AvaloniaUI, WPF and .net-xaml-platforms else. Support native aot (Avaloniaui) ### Lemon.ModuleNavigation.AvaloniaUI Extending `Lemon.ModuleNavigation`, this package provides handy NavigationContainers specifically designed for AvaloniaUI. ### Key Advantages: - **Lightweight**: Minimal performance overhead. - **Commonly module options are provided**:LoadonDemand; Unload; Multi-Instance. - **Few dependencies**: Only relies on `Microsoft.Extensions.DependencyInjection.Abstractions`. - **Framework Agnostic**: Does not enforce any specific MVVM framework, allowing developers to use the MVVM framework of their choice. - **Highly Extensible**: Easily customizable to suit specific needs. - **Simple to Use**. --- ModuleNavigation screenshot: ![20241024223837_rec_](https://github.com/user-attachments/assets/50ccc0e0-cf4c-45aa-a596-9ec0d78f2a1f) ViewNavigation screenshot: ![20241024223936_rec_](https://github.com/user-attachments/assets/f969743d-38b0-4813-87b0-47f1c2239b23) --- ### Usage: #### Create module with View and ViewModel ##### Module.cs ```csharp using System; using Lemon.ModuleNavigation.Avaloniaui; namespace Lemon.ModuleNavigation.Sample.ModuleAs { public class ModuleA : AvaModule { public ModuleA(IServiceProvider serviceProvider) : base(serviceProvider) { } /// /// Specifies whether this module needs to be loaded on demand /// Default value is True /// public override bool LoadOnDemand => false; /// /// Alias of module for displaying usually /// Default value is class name of Module /// public override string? Alias => base.Alias; /// /// Specifies whether this module allow multiple instances /// If true,every navigation to this module will generate a new instance. /// Default value is false. /// public override bool ForceNew => base.ForceNew; /// /// Specifies whether this module can be unloaded. /// Default value is false. /// public override bool CanUnload => base.CanUnload; /// /// Initialize /// public override void Initialize() { base.Initialize(); } } } ``` ##### View.cs ```csharp using Avalonia.Controls; using Lemon.ModuleNavigation.Abstracts; namespace Lemon.ModuleNavigation.Sample.ModuleAs; public partial class ViewA : UserControl, IView { public ViewA() { InitializeComponent(); } } ``` ##### ViewModel.cs ```csharp using Lemon.ModuleNavigation.Abstracts; using Lemon.ModuleNavigation.Sample.ViewModels; using System; namespace Lemon.ModuleNavigation.Sample.ModuleAs { public class ViewModelA : IViewModel { public void Dispose() { } } } ``` #### In MainView.axaml or MainWindow.axaml ##### ContentControl ```xaml ``` ##### TabControl ```xaml