AppDimens.Net
3.6.1
dotnet add package AppDimens.Net --version 3.6.1
NuGet\Install-Package AppDimens.Net -Version 3.6.1
<PackageReference Include="AppDimens.Net" Version="3.6.1" />
<PackageVersion Include="AppDimens.Net" Version="3.6.1" />
<PackageReference Include="AppDimens.Net" />
paket add AppDimens.Net --version 3.6.1
#r "nuget: AppDimens.Net, 3.6.1"
#:package AppDimens.Net@3.6.1
#addin nuget:?package=AppDimens.Net&version=3.6.1
#tool nuget:?package=AppDimens.Net&version=3.6.1
AppDimens.Net
Responsive dimensions for .NET — the core of AppDimens for .NET. Scaled dp/sp (16.Sdp(), 14.Ssp()),
orientation inverters, conditional facilitators, builders, snapshot cache with allocation-free fast lanes, an
event-driven resize watcher, HostDimensScope for any UI host and FakeAppDimensContext for tests.
Bit-for-bit port of appdimens-kmp.
📖 Complete guide: AppDimens.Net documentation · API reference: API.md · All packages: docs index
| Targets | net8.0 · net9.0 · net10.0 (+ net11.0 with SDK 11) |
| Dependencies | none |
| UI frameworks | .NET MAUI (AppDimens.Net.Maui), WPF (AppDimens.Net.Wpf), Windows Forms (AppDimens.Net.WinForms), WinUI 3 (AppDimens.Net.WinUI), any other host (HostDimensScope) |
Why?
Fixed sizes look right on one screen only. AppDimens treats your numbers as sizes on a 300 dp-wide reference
screen and scales them to the real window: 16.Sdp() is 19.2 on a 360 dp phone, 32 on 600 dp, 48 on 900 dp.
Install
dotnet add package AppDimens.Net
# + your UI framework integration, e.g.
dotnet add package AppDimens.Net.Maui # or .Wpf / .WinForms / .WinUI
Start (one line per framework)
| Framework | Call once |
|---|---|
| .NET MAUI | AppDimensMaui.AttachWindow(window) in App.CreateWindow |
| WPF | AppDimensWpf.Initialize(this) before InitializeComponent() |
| Windows Forms | AppDimensWinForms.Initialize(this) |
| WinUI 3 | AppDimensWinUI.Initialize(window) in OnLaunched |
| Any other host | AppDimensHost.Activate(new HostDimensScope()).Update(widthDp, heightDp, density) |
Use
using AppDimens.Net.Code.Scaled;
float pad = 16.Sdp(); // smallest width — default for padding, margins, icons
float header = 56.Hdp(); // height axis
float side = 200.Wdp(); // width axis
float text = 14.Ssp(); // text, follows the user's font scale
float tall = 16.Sdpa(); // + aspect-ratio correction
float split = 16.Sdpi(); // ignores split-screen shrinking
float tablet = 16.ScaledDp()
.Screen(AppDimens.Net.Common.DpQualifier.SmallWidth, 600, 24) // sw ≥ 600 → 24
.Sdp();
Test
using AppDimens.Net.Code.Scaled;
using AppDimens.Net.Testing;
var ctx = new FakeAppDimensContext();
ctx.SetConfig(360, 800);
float phone = 16.Sdp(ctx); // 19.2
Português
dotnet add package AppDimens.Net + o pacote do seu framework → inicialize a janela uma vez → 16.Sdp() (tamanhos),
14.Ssp() (texto), 56.Hdp() / 200.Wdp() (altura/largura). Guia completo:
docs/AppDimens.Net.
Apache-2.0 — © Jean Bodenberg · Repository
| 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
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (18)
Showing the top 5 NuGet packages that depend on AppDimens.Net:
| Package | Downloads |
|---|---|
|
AppDimens.Net.Fluid
AppDimens .NET — Fluid scaling strategy module. |
|
|
AppDimens.Net.Percent
AppDimens .NET — Percent scaling strategy module. |
|
|
AppDimens.Net.Fill
AppDimens .NET — Fill scaling strategy module. |
|
|
AppDimens.Net.Resize
AppDimens .NET — Resize strategy module. |
|
|
AppDimens.Net.Interpolated
AppDimens .NET — Interpolated scaling strategy module. |
GitHub repositories
This package is not used by any popular GitHub repositories.