AppDimens.Net.Percent
3.6.1
dotnet add package AppDimens.Net.Percent --version 3.6.1
NuGet\Install-Package AppDimens.Net.Percent -Version 3.6.1
<PackageReference Include="AppDimens.Net.Percent" Version="3.6.1" />
<PackageVersion Include="AppDimens.Net.Percent" Version="3.6.1" />
<PackageReference Include="AppDimens.Net.Percent" />
paket add AppDimens.Net.Percent --version 3.6.1
#r "nuget: AppDimens.Net.Percent, 3.6.1"
#:package AppDimens.Net.Percent@3.6.1
#addin nuget:?package=AppDimens.Net.Percent&version=3.6.1
#tool nuget:?package=AppDimens.Net.Percent&version=3.6.1
AppDimens.Net.Percent
Percent scaling — strictly proportional to an axis, plus Space helpers for literal percentages.
Part of AppDimens for .NET (C# port of appdimens-kmp) · requires AppDimens.Net (installed automatically).
Works with .NET MAUI, WPF, Windows Forms, WinUI 3 and plain .NET (net8.0 / net9.0 / net10.0).
📖 Complete guide: AppDimens.Net.Percent documentation · API reference: API.md
What it does
The Percent strategy scales linearly with the chosen axis (value × axis ÷ 300): PSdp follows the smaller side, PHdp the height and PWdp the width. It also ships the Space helpers for literal percentages of the window: 50.SpaceWDp(ctx) = 50 % of the width, 50.SpaceHDp(ctx) = 50 % of the height, 25.SpaceSwDp(ctx) = 25 % of the smaller side.
16 with this strategy |
Phone 360×800 | Tablet 800×1280 | Desktop 1280×800 |
|---|---|---|---|
16.PSdp() |
19.2 | 42.7 | 42.7 |
16.PHdp() |
42.7 | 68.3 | 42.7 |
16.PWdp() |
19.2 | 42.7 | 68.3 |
16.Sdp() (core Scaled) |
19.2 | 42.7 | 42.7 |
Install
dotnet add package AppDimens.Net.Percent
Use
- Initialize once for your UI framework: MAUI
AppDimensMaui.AttachWindow(window)· WPFAppDimensWpf.Initialize(this)· WinFormsAppDimensWinForms.Initialize(this)· WinUIAppDimensWinUI.Initialize(window). - Call the extensions:
using AppDimens.Net.Code.Percent;
float padding = 16.PSdp(); // smaller side of the window
float header = 56.PHdp(); // height
float sidebar = 200.PWdp(); // width
float tall = 16.PSdpa(); // + aspect-ratio correction
float split = 16.PSdpi(); // ignores split-screen shrinking
With an explicit context: 16.PSdp(ctx), 16.PSdpPx(ctx), DimenPercent.PSdp(ctx, 16), 24.ToPercentDp(ctx, qualifier: DpQualifier.Width).
Português
dotnet add package AppDimens.Net.Percent → inicialize a janela uma vez → using AppDimens.Net.Code.Percent; → 16.PSdp(), 56.PHdp(), 200.PWdp().
Guia completo: https://github.com/bodenberg/appdimens-net-binding/blob/main/docs/AppDimens.Net.Percent/README.md
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
- AppDimens.Net (>= 3.6.1)
-
net8.0
- AppDimens.Net (>= 3.6.1)
-
net9.0
- AppDimens.Net (>= 3.6.1)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on AppDimens.Net.Percent:
| Package | Downloads |
|---|---|
|
AppDimens.Net.Maui
AppDimens .NET — .NET MAUI integration: live window scopes, event-driven resize watcher, XAML markup extensions and converters. |
|
|
AppDimens.Net.Sdk
AppDimens .NET meta-package ("BOM"): pulls the principal library plus every strategy module with a single reference. |
|
|
AppDimens.Net.Wpf
AppDimens .NET — WPF integration: window scope that follows size and per-monitor DPI, live {ad:Sdp 16} XAML markup extensions (scaled, fluid, percent) and value converters. |
|
|
AppDimens.Net.WinUI
AppDimens .NET — WinUI 3 (Windows App SDK) integration: window scope that follows size and scale, {ad:Sdp Value=16} XAML markup re-applied on resize, and value converters. |
|
|
AppDimens.Net.WinForms
AppDimens .NET — Windows Forms integration: form scope that follows client size and per-monitor DPI, Apply(...) re-layout helper and dp → pixel / point converters. |
GitHub repositories
This package is not used by any popular GitHub repositories.