Skip to main content

UI layer

Purpose

Mnemo.UI is the Avalonia desktop shell: windows, controls, view models, feature modules, themes, and navigation. It references Infrastructure only for composition and typed services injected into VMs.

Code location

AreaPath
App entryMnemo.UI/App.axaml.cs
Composition rootMnemo.UI/Services/Bootstrapper.cs
Root shellMnemo.UI/Views/MainWindow.axaml(.cs)
ModulesMnemo.UI/Modules/**
Shared componentsMnemo.UI/Components/**, Mnemo.UI/Themes/**

Main interfaces / classes

  • MainWindowViewModel — sidebar, top bar, navigation host, right sidebar VM wiring.
  • NavigationService / INavigationService — resolves which view model occupies workspace (MainWindow binds Navigation.CurrentViewModel).
  • IModule implementations — one class per feature package (Notes, Flashcards, Path, …).

Startup / registration flow

App.OnFrameworkInitializationCompleted calls Bootstrapper.Build(), assigns MainWindow.DataContext, sets desktop.MainWindow. Modules already ran inside Bootstrapper before the window appears—see Startup flow.

MainWindow (user-visible summary)

MainWindow is the root window: left Sidebar, Topbar, central WorkspaceKeybindHost hosting Navigation.CurrentViewModel, optional RightSidebar, and ToastHost. Global keybind tunneling hooks live in code-behind for chords that must work shell-wide.

How to extend

  • Prefer adding or extending an IModule instead of editing Bootstrapper for every route—keep bootstrap for cross-cutting singletons only.
  • New controls: place under Components/ with AXAML + code-behind partials matching existing patterns.

Gotchas

  • Avalonia layout: StackPanel / Grid do not support padding or corner radius on the panel itself—use Margin or wrap in Border (team rule).
  • Theme resources are dynamic—avoid hard-coded brushes in feature views when a theme key exists.

Related: Module system, overview