Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 19, 2025

This PR adds comprehensive documentation for device-independent units in .NET MAUI, addressing a key gap in the documentation where this concept was mentioned frequently but never clearly defined.

What's Added

New Documentation File

Created /docs/user-interface/device-independent-units.md that provides:

  • Clear definition: Device-independent units (DIUs) represent approximately 1/160th of an inch of physical screen space
  • Platform mapping: Explains the 1:1 relationship to native unit systems:
    • iOS: 1 DIU = 1 point
    • Android: 1 DIU = 1 density-independent pixel (dp)
    • Windows: 1 DIU = 1 device-independent pixel
    • macOS: 1 DIU = 1 point
  • Practical examples: Code samples showing usage in layouts, fonts, animations, and responsive design
  • Best practices: Guidelines for touch targets, common spacing values, and avoiding manual conversions

Enhanced Cross-References

Updated existing files that mention device-independent units to link to the new comprehensive documentation:

  • fonts.md - FontSize property and font icon sizing
  • align-position.md - Margin and padding measurements
  • fundamentals/gestures/swipe.md - SwipeGestureRecognizer threshold
  • fundamentals/triggers.md - AdaptiveTrigger window measurements
  • user-interface/includes/basic-animation-dotnet10.md - Animation translation values

Navigation Updates

Added the new documentation to the Table of Contents under User Interface > Controls, positioned logically after "Align and position controls".

Why This Matters

The documentation clarifies that device-independent units in .NET MAUI are not just a naming difference from platform-specific units, but rather a unified abstraction that automatically handles density scaling across platforms. This provides developers with the understanding they need to create consistent UI layouts that work properly across iOS, Android, Windows, and macOS devices.

Fixes #1042.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link

Learn Build status updates of commit 507100a:

✅ Validation status: passed

For more details, please refer to the build report.

Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 issues. Other issues are also a high priority. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Copy link

Learn Build status updates of commit ea28a1a:

✅ Validation status: passed

File Status Preview URL Details
docs/fundamentals/gestures/swipe.md ✅Succeeded View (>=net-maui-8.0)
docs/fundamentals/triggers.md ✅Succeeded View (>=net-maui-8.0)
docs/TOC.yml ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/align-position.md ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/device-independent-units.md ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/fonts.md ✅Succeeded View (>=net-maui-8.0)
docs/user-interface/includes/basic-animation-dotnet10.md ✅Succeeded View (>=net-maui-8.0)

For more details, please refer to the build report.

@Copilot Copilot AI changed the title [WIP] Document the definition of Device-Independent Units on MAUI Document device-independent units and their relationship to platform-specific units Sep 19, 2025
@Copilot Copilot AI requested a review from jfversluis September 19, 2025 19:44
Copilot finished work on behalf of jfversluis September 19, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants