dotnet / dotnet/docs-maui

Custom controls

Open
#1,216 0 comments 2 reactions 0 assignees View on GitHub
doc-idea Pri3
Dominant language
No language data
Stars
282
Forks
265
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Create content about how to create custom controls in .NET MAUI. This should include writing `IVisualElementTree` overrides/wiring into the LogicalChildren APIs.

For a custom control whose size changes (e.g. a property change), in most situations the underlying platform's invalidation will kick in and trigger a measure/arrange pass if necessary. But not in all situations, and it can differ per platform. The advice is to see if a custom control works without calling `InvalidateMeasure`. If it doesn't, add a call in to `InvalidateMeasure`.

https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.invalidatemeasure?view=winrt-22621#remarks is a good summary of the situation for MAUI, although MAUI is more complicated by having different platforms that have different rules for when they invalidate things.

https://github.com/dotnet/maui/issues/11106

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.