davidortinau/maui-skills/maui-custom-handlers
Claude Code and agent skill by davidortinau/maui-skills
- community
Checking that the SKILL.md file is still in the repository.
Guide for creating custom .NET MAUI handlers, customizing existing handlers with property mappers, and implementing platform-specific native views. Covers PrependToMapping/ModifyMapping/AppendToMapping, PropertyMapper, CommandMapper, partial handler classes, and handler registration. USE FOR: "custom handler", "PropertyMapper", "AppendToMapping", "PrependToMapping", "ModifyMapping", "CommandMapper", "platform-specific rendering", "native view", "handler registration", "custom control renderer".…
Install
npx vskill@latest install davidortinau/maui-skills/maui-custom-handlersSKILL.md
.NET MAUI Custom Handlers
Decision: Customize Existing vs. Create New
| Scenario | Approach | |
|---|---|---|
| Change how a built-in control looks/behaves on one platform | Customize — use AppendToMapping / PrependToMapping | |
| Need the change on only some instances of a control | Customize — subclass the control + type-check in mapper | |
| Need a completely new cross-platform control with native backing | Create new handler with partial classes |
⚠️ Prefer `AppendToMapping` overModifyMapping.ModifyMappingreplacesthe default mapper action entirely — if the framework adds behaviour in afuture release, your override silently drops it.
Gotchas & Common Mistakes
Mapper customizations are global
Every instance of the control is affected. Guard with a subclass check for instance-specific behaviour:
Unsubscribe native events in HandlerChanging
Failing to remove native event handlers causes memory leaks because the native view may outlive the managed wrapper.
Partial class name/namespace mismatch
Namespace and class name must match exactly across the shared handler file and every platform file. A mismatch silently creates separate classes — no compiler error, just a handler that does nothing on that platform.
Conditional using placement
The using PlatformView = ... aliases must be at the top of the shared handler file (not the platform files) so the ViewHandler<TControl, TPlatformView> base-class generic resolves correctly per platform.
Missing CreatePlatformView()
Each platform partial must override CreatePlatformView(). Omitting it produces a compile error — but the error message points at the base class, not your handler, making it confusing to debug.
Mapper Method Selection
| Method | Risk | Use when | |
|---|---|---|---|
AppendToMapping | Low — runs after default | Adding behaviour without breaking defaults | |
PrependToMapping | Low — runs before default | Setting initial state that the default can override | |
ModifyMapping | ⚠️ High — replaces default | You intentionally want to suppress the framework's mapper logic |
PropertyMapper vs. CommandMapper
| Mapper | Purpose | Pattern | |
|---|---|---|---|
PropertyMapper | Sync a bindable property to the native view | Runs whenever the property value changes | |
CommandMapper | Fire-and-forget action from control → handler | Runs once per invocation, no return value |
⚠️ Don't put property sync logic inCommandMapper— it won't re-run whenthe property changes, leading to stale native views.
Checklist — New Handler
- [ ] Cross-platform control inherits
View(or appropriate base) - [ ] Shared handler file has conditional
using PlatformView = ...aliases - [ ] Handler inherits
ViewHandler<TControl, PlatformView> - [ ]
PropertyMappermaps every bindable property - [ ] Each platform partial overrides
CreatePlatformView() - [ ] Namespace + class name identical across all partial files
- [ ] Handler registered in
MauiProgram.csviaConfigureMauiHandlers - [ ] Native event subscriptions cleaned up in
HandlerChanging
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/maui-skills/skills/maui-custom-handlers/SKILL.md
Popularity
- Repository stars
- 176
- Repository forks
- 21
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/davidortinau/maui-skills/maui-custom-handlers)