How yiszza/mdc-maui works
Purpose and Entry Points
Material.Components.Maui is a reusable .NET MAUI library implementing Material-style UI controls, distributed as Material.Components.Maui. Its project entry is src/Material.Components.Maui/Material.Components.Maui.csproj; the solution is src/Material.Components.Maui.sln. A multi-platform MAUI sample consumes the library through sample/MauiProgram.cs, with application startup in sample/App.xaml and initial navigation in sample/Pages/MainPage.xaml.
Library Registration and Consumer Boundary
Consumers configure the library through MAUI builder extensions, then use controls from XAML or C#. src/Material.Components.Maui/Extensions/MauiAppBuilderExtensions.cs is the integration boundary for registration, while src/Material.Components.Maui/GlobalUsings.cs establishes library-wide dependencies. Fluent APIs under src/Material.Components.Maui/FluentExtensions/ expose shared control capabilities without coupling consumers to implementation details.
Control Model and Shared Contracts
The core product is a set of MAUI visual controls organized by feature under src/Material.Components.Maui/Components/. Components share composable element contracts—content, item collections, styling, shapes, state layers, ripple, icons, and editing—from src/Material.Components.Maui/Interfaces/IElement.cs, src/Material.Components.Maui/Interfaces/IStyleElement.cs, and src/Material.Components.Maui/Interfaces/IEditableElement.cs. This separates public control semantics from rendering and platform adaptation.
Rendering and Interaction Layer
Most controls pair a public control with a drawable responsible for Material visuals and state-driven rendering: src/Material.Components.Maui/Components/Button/Button.cs, src/Material.Components.Maui/Components/Button/ButtonDrawable.cs, and src/Material.Components.Maui/Components/TouchGraphicsView.cs. The same pattern supports input, selection, navigation, and feedback controls, including src/Material.Components.Maui/Components/TextField/TextField.cs and src/Material.Components.Maui/Components/NavigationDrawer/NavigationDrawer.cs.
Text Editing and Native Handler Boundary
Text input is the most explicit native integration path. src/Material.Components.Maui/Handlers/TextField/TextFieldHandler.cs maps the cross-platform TextField to native views, with per-platform implementations in src/Material.Components.Maui/Handlers/TextField/TextFieldHandler.android.cs, src/Material.Components.Maui/Handlers/TextField/TextFieldHandler.windows.cs, and platform text-view adapters under src/Material.Components.Maui/Components/TextField/. Editing state and selection event types flow through primitives such as src/Material.Components.Maui/Primitives/TextRange.cs.
Platform-Specific Presentation
Popup and context-menu behavior are split into shared APIs plus Android, Windows, and Apple-platform implementations: src/Material.Components.Maui/Components/Popup/Popup.cs, src/Material.Components.Maui/Components/Popup/Popup.android.cs, and src/Material.Components.Maui/Components/ContextMenu/ContextMenu.windows.cs. This is the principal boundary where MAUI abstractions yield to native platform presentation APIs. Supported app targets represented by the sample are Android, iOS, Mac Catalyst, Windows, and Tizen.
Design System Resources
Material design tokens and XAML resource dictionaries provide consistent colors, elevation, shapes, state opacity, and per-control defaults. Core tokens reside in src/Material.Components.Maui/Tokens/MaterialColors.cs, src/Material.Components.Maui/Tokens/Shape.cs, and src/Material.Components.Maui/Tokens/Elevation.cs; aggregate styling is rooted in src/Material.Components.Maui/Styles/MaterialStyles.xaml. Controls consume these resources while allowing consumer-level overrides.
Sample and Documentation
The sample is a verification and usage host rather than a backend application: sample/SampleApp.csproj, sample/Pages/01.OverviewPage.xaml, and sample/Pages/SettingsPage.xaml. Documentation is static Markdown organized per control in docs/, with the documentation site referenced externally in the README. No server, database, authentication provider, or external runtime service is present; the material infrastructure is .NET MAUI plus native platform UI APIs.
Main entry points: MaterialStyles.xaml Material styles · SampleApp.csproj Sample application · Button.cs Button · TextField.cs Text field
Components 24
MAUI Library
Reusable Material control package.
- Material.Components.Maui
src/Material.Components.Maui/Material.Components.Maui.csproj - Builder registration · Consumer integration boundary.
src/Material.Components.Maui/Extensions/MauiAppBuilderExtensions.cs - Global dependencies
src/Material.Components.Maui/GlobalUsings.cs - Fluent control APIs
- Material controls · Public controls organized by feature.
- Element contracts · Composable content, item, state, and visual semantics.
src/Material.Components.Maui/Interfaces/IElement.cs - Style contract
src/Material.Components.Maui/Interfaces/IStyleElement.cs - Editable contract
src/Material.Components.Maui/Interfaces/IEditableElement.cs
Rendering & Native
Drawing, handlers, and platform presentation.
- Button
src/Material.Components.Maui/Components/Button/Button.cs - Button drawable · Draws Material visuals from control state.
src/Material.Components.Maui/Components/Button/ButtonDrawable.cs - Touch graphics view
src/Material.Components.Maui/Components/TouchGraphicsView.cs - Text field
src/Material.Components.Maui/Components/TextField/TextField.cs - Text field handler · Maps cross-platform text input to native views.
src/Material.Components.Maui/Handlers/TextField/TextFieldHandler.cs - Text range
src/Material.Components.Maui/Primitives/TextRange.cs - Popup API · Shared popup API with native implementations.
src/Material.Components.Maui/Components/Popup/Popup.cs
Design System
Shared Material tokens and styles.
- Material styles · Aggregates per-control defaults.
src/Material.Components.Maui/Styles/MaterialStyles.xaml - Material colors
src/Material.Components.Maui/Tokens/MaterialColors.cs - Shape tokens
src/Material.Components.Maui/Tokens/Shape.cs - Elevation tokens
src/Material.Components.Maui/Tokens/Elevation.cs
Sample & Docs
Consumer usage and documentation.
- Sample application · Multi-platform verification and usage host.
sample/SampleApp.csproj - Sample bootstrap
sample/MauiProgram.cs - Main navigation · Initial sample navigation.
sample/Pages/MainPage.xaml - Overview page
sample/Pages/01.OverviewPage.xaml - Control documentation
Connections 25
- Material.Components.Maui → Builder registration: exports
- Material.Components.Maui → Material controls: packages
- Global dependencies → Material controls: shared dependencies
- Builder registration → Material controls: registers
- Fluent control APIs → Material controls: extends
- Material controls → Element contracts: implements
- Material controls → Style contract: implements
- Material controls → Editable contract: implements
- Material controls → Button: includes
- Button → Button drawable: renders with
- Button → Touch graphics view: handles interaction via
- Material controls → Text field: includes
- Text field → Text field handler: maps through
- Text field → Text range: uses editing state
- Material controls → Popup API: includes
- Material styles → Material colors: uses
- Material styles → Shape tokens: uses
- Material styles → Elevation tokens: uses
- Material controls → Material styles: consumes
- Sample application → Material.Components.Maui: consumes
- Sample bootstrap → Builder registration: configures
- Sample application → Sample bootstrap: starts
- Main navigation → Overview page: navigates to
- Sample application → Main navigation: initial UI
- Control documentation → Material controls: documents