Skip to content

Sample: Material 3 handler customization — .NET MAUI 11 Preview 5#773

Open
davidortinau wants to merge 1 commit into
dotnet:mainfrom
davidortinau:daortin/p5-sample-material3-handler
Open

Sample: Material 3 handler customization — .NET MAUI 11 Preview 5#773
davidortinau wants to merge 1 commit into
dotnet:mainfrom
davidortinau:daortin/p5-sample-material3-handler

Conversation

@davidortinau

Copy link
Copy Markdown
Contributor

Adds a new sample under 11.0/UserInterface/Material3/Material3HandlerCustomization/ that demonstrates the now-public Android Material 3 helper types and Handler2 classes added in .NET MAUI 11 Preview 5 (dotnet/maui#35323, closes dotnet/maui#35124).

In prior previews, types like MauiMaterialEditText, MauiMaterialContextThemeWrapper, and the Handler2 Editor / Picker / RadioButton / TimePicker / Label classes were internal. Preview 5 makes them public and adds a PlatformViewFactory hook so an app can return its own subclass without touching the rest of the handler pipeline.

What the sample shows

  • <UseMaterial3>true</UseMaterial3> to opt in to the Material 3 handler set on Android
  • A MyMaterialEditText : MauiMaterialEditText subclass that uppercases characters as they're typed
  • EditorHandler2.PlatformViewFactory = ... wired inside #if ANDROID, mirroring the default CreatePlatformView setup (MauiMaterialContextThemeWrapper.Create, ImeOptions=Done, Gravity=Top, TextAlignment=ViewStart, single-line and horizontal-scroll disabled) so theming and IME behaviour are preserved

The customisation is Android-only; the page falls back to the default Editor handler on iOS, Mac Catalyst, and Windows so the app launches cleanly on every platform.

Note

11.0/Directory.Build.props pin to Preview 3 applies here too — see the BoxView.Fill PR description.

Demonstrates the now-public Android Material 3 helper types and
Handler2 classes (dotnet/maui#35323, closes dotnet/maui#35124).

Includes:
- <UseMaterial3>true</UseMaterial3> to opt in to the Material 3 handlers
- MyMaterialEditText : MauiMaterialEditText subclass that uppercases
  characters as they are typed
- EditorHandler2.PlatformViewFactory wired in #if ANDROID, mirroring
  the default CreatePlatformView setup so theming + IME behaviour are
  preserved
- docregions for inclusion in docs/user-interface/material-design.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Net 11] Expose Material Handlers and Helpers as Public

1 participant