AppDimens.Net.Units
3.6.0
dotnet add package AppDimens.Net.Units --version 3.6.0
NuGet\Install-Package AppDimens.Net.Units -Version 3.6.0
<PackageReference Include="AppDimens.Net.Units" Version="3.6.0" />
<PackageVersion Include="AppDimens.Net.Units" Version="3.6.0" />
<PackageReference Include="AppDimens.Net.Units" />
paket add AppDimens.Net.Units --version 3.6.0
#r "nuget: AppDimens.Net.Units, 3.6.0"
#:package AppDimens.Net.Units@3.6.0
#addin nuget:?package=AppDimens.Net.Units&version=3.6.0
#tool nuget:?package=AppDimens.Net.Units&version=3.6.0
<div align="center">
📏 AppDimens.Net.Units
Physical units — mm, cm and inch converted to dp/px/sp with real device DPI.
Part of the AppDimens for .NET family · requires AppDimens.Net (core).
</div>
🎯 What is it?
When UI must match the physical world — rulers, ID/photo frames, credit-card-sized
widgets, print previews — dp isn't enough. This module converts millimeters,
centimeters and inches into screen units using the actual device DPI.
📦 Installation
dotnet add package AppDimens.Net.Units
Depends on AppDimens.Net (pulled automatically). Attach a MAUI window first or pass an explicit
IAppDimensContext.
🚀 Quick start
using AppDimens.Net.Units;
// A standard credit card is 85.6 × 53.98 mm
float wDp = DimenPhysicalUnits.ToDpFromMm(85.6f);
float hDp = DimenPhysicalUnits.ToDpFromMm(53.98f);
card.WidthRequest = wDp;
card.HeightRequest = hDp;
// 1 inch ruler bar in pixels
float rulerPx = DimenPhysicalUnits.ToPxFromInch(1f);
// Circle radius from a 25 mm diameter
float r = DimenPhysicalUnits.RadiusFromDiameter(25f, UnitType.Mm);
🧭 API — DimenPhysicalUnits
| Method | Converts |
|---|---|
ToDpFromMm(mm) · ToDpFromCm(cm) · ToDpFromInch(inch) |
physical length → dp |
ToPxFromMm · ToPxFromCm · ToPxFromInch |
physical length → px |
ToSpFromMm · ToSpFromCm · ToSpFromInch |
physical length → sp |
RadiusFromDiameter(diameter, unitType) |
diameter → radius (screen units) |
All methods accept an optional IAppDimensContext (defaults to the ambient context).
💡 When to use
| Scenario | Recommendation |
|---|---|
| Real-world sized UI (rulers, cards, print) | ✅ Units |
| Density-flavored responsive sizing | Density |
| Everything else | core Scaled strategy |
⚡ Performance
Conversions run through the shared snapshot cache; DPI changes invalidate automatically via the event watcher.
📚 Full package family
AppDimens.Net · Percent · Power · Auto · Logarithmic · Fluid · Interpolated · Diagonal · Perimeter · Fill · Fit · Density · Resize · Maui · Sdk meta-package
Apache-2.0 — © Jean Bodenberg · Repository · Formulas are bit-a-bit ports of appdimens-kmp
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AppDimens.Net (>= 3.6.0)
-
net8.0
- AppDimens.Net (>= 3.6.0)
-
net9.0
- AppDimens.Net (>= 3.6.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AppDimens.Net.Units:
| Package | Downloads |
|---|---|
|
AppDimens.Net.Sdk
AppDimens .NET meta-package ("BOM"): pulls the principal library plus every strategy module with a single reference. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.0 | 101 | 8/23/2026 |