# materialdesigninxaml/materialdesigninxamltoolkit architecture

> Architecture diagram of the GitHub repository materialdesigninxaml/materialdesigninxamltoolkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/materialdesigninxaml/materialdesigninxamltoolkit
- Repository: https://github.com/materialdesigninxaml/materialdesigninxamltoolkit

## Overview

##### Main Components

a. Core Libraries:
- MaterialDesignThemes.Wpf (UI controls and components)
- MaterialDesignThemes.MahApps (MahApps integration)

b. Supporting Components:
- Resource Dictionaries (Themes and Styles)
- Controls Framework
- Theme Management

**┌─ Application Layer ─────────────────────────────┐**
- Consumer WPF Applications                       │
- ┬───────────────────────────┬─┘

**┌─ Integration Layer ┴───────────┐   ┌─ MahApps ┴─────────┐**
- MaterialDesignThemes.MahApps   │   │ External Framework │
- ┬────────────┘   └──────────────────┬─┘

**┌─ Theme Layer ─────┴────────────────────────────────┬──┘**
- MaterialDesignThemes.Wpf                           │
- Controls                                        │
- Themes                                          │
- Converters                                      │
- Behaviors                                       │
- ┬────────────────────────────────┘

**┌─ Foundation Layer ┴────────────────────────────────┐**
- MaterialDesignColors.Wpf                           │
- Swatches                                        │
- ┘

##### Key Relationships

- Theme inheritance and override paths
- Resource dictionary loading sequences
- Control dependencies

##### Component Details

- Controls (Rectangle)
- Themes (Hexagon)
- Resources (Circle)
- Services (Rounded Rectangle)

##### Important Subsystems

a. Theme Management:
**┌─ Theme System ────────────────┐**
- BundledTheme              │
- CustomColorTheme          │
- BaseTheme                 │
- ThemeManager             │
- ┘

b. Control Framework:
**┌─ Control Framework ──────────┐**
- Material Controls        │
- Custom Behaviors         │
- Converters              │
- Assistants              │
- ┘

##### Integration Points

Highlight:
- Resource loading mechanisms
- Theme switching capabilities
- MahApps integration points

##### Data Flow

Flow of:
- Theme changes
- Control state management
- Resource dictionary loading

Use different line styles to indicate:
- Direct dependencies (solid)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Application Layer"
        WPFApps["Consumer WPF Applications"]
    end

    subgraph "Integration Layer"
        MahAppsInt["MaterialDesignThemes.MahApps"]:::integration
        MahAppsExt["MahApps Framework"]:::external
    end

    subgraph "Theme Layer"
        MDThemes["MaterialDesignThemes.Wpf"]:::core
        Controls["Controls Framework"]:::component
        Themes["Resource Dictionaries"]:::component
        Converters["Converters"]:::component
        Behaviors["Behaviors"]:::component

        subgraph "Theme System"
            BundledTheme["Bundled Theme"]:::theme
            CustomTheme["Custom Color Theme"]:::theme
            BaseTheme["Base Theme"]:::theme
            ThemeManager["Theme Manager"]:::service
        end

        subgraph "Icon System"
            PackIcon["Pack Icon"]:::component
            IconKind["Icon Kind"]:::component
            IconFactory["Icon Data Factory"]:::component
        end
    end

    subgraph "Foundation Layer"
        MDColors["MaterialDesignColors.Wpf"]:::core
        ColorSystem["Color System"]:::component
        Swatches["Swatches"]:::component
        ColorMgmt["Color Management"]:::component
    end

    %% Relationships
    WPFApps --> MahAppsInt
    WPFApps --> MDThemes
    MahAppsInt --> MDThemes
    MahAppsExt --> MahAppsInt
    MDThemes --> MDColors
    
    Controls --> MDThemes
    Themes --> MDThemes
    Converters --> MDThemes
    Behaviors --> MDThemes

    BundledTheme --> ThemeManager
    CustomTheme --> ThemeManager
    BaseTheme --> ThemeManager
    ThemeManager --> MDThemes

    PackIcon --> IconKind
    IconKind --> IconFactory
    IconFactory --> MDThemes

    ColorSystem --> MDColors
    Swatches --> MDColors
    ColorMgmt --> MDColors

    %% Click Events
    click MDColors "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignColors.Wpf/MaterialDesignColors.Wpf.csproj"
    click MDThemes "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj"
    click MahAppsInt "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj"
    click Themes "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/src/MaterialDesignThemes.Wpf/Themes/"
    click ColorMgmt "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/src/MaterialDesignColors.Wpf/ColorManipulation/"
    click PackIcon "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/PackIcon.cs"
    click IconKind "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/PackIconKind.cs"
    click IconFactory "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/PackIconDataFactory.cs"
    click Controls "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/src/MaterialDesignThemes.Wpf/"
    click BaseTheme "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/Theme.cs"
    click ThemeManager "https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/src/MaterialDesignThemes.Wpf/ThemeAssist.cs"

    %% Styles
    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef component fill:#bbf,stroke:#333,stroke-width:1px
    classDef service fill:#bfb,stroke:#333,stroke-width:1px
    classDef theme fill:#ffb,stroke:#333,stroke-width:1px
    classDef integration fill:#fbf,stroke:#333,stroke-width:1px
    classDef external fill:#ddd,stroke:#333,stroke-width:1px

    %% Legend
    subgraph Legend
        CoreLib["Core Library"]:::core
        Comp["Component"]:::component
        Serv["Service"]:::service
        ThemeComp["Theme Component"]:::theme
        Int["Integration"]:::integration
        Ext["External"]:::external
    end
```
