AppDimens.Net.WinUI 3.6.1

dotnet add package AppDimens.Net.WinUI --version 3.6.1
                    
NuGet\Install-Package AppDimens.Net.WinUI -Version 3.6.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AppDimens.Net.WinUI" Version="3.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AppDimens.Net.WinUI" Version="3.6.1" />
                    
Directory.Packages.props
<PackageReference Include="AppDimens.Net.WinUI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AppDimens.Net.WinUI --version 3.6.1
                    
#r "nuget: AppDimens.Net.WinUI, 3.6.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AppDimens.Net.WinUI@3.6.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AppDimens.Net.WinUI&version=3.6.1
                    
Install as a Cake Addin
#tool nuget:?package=AppDimens.Net.WinUI&version=3.6.1
                    
Install as a Cake Tool

AppDimens.Net.WinUI

📖 Documentation: AppDimens.Net.WinUI guide · complete API reference · all AppDimens .NET packages

WinUI 3 (Windows App SDK) integration for AppDimens.Net — the pure C# port of AppDimens KMP. {ad:Sdp Value=16} values follow the window size and display scale and are re-applied automatically when the window changes.

Frameworks net8.0-windows10.0.19041.0, net9.0-…, net10.0-… (min. Windows 10 1809)
Windows App SDK 1.6 or newer (your app keeps its own version)
Depends on AppDimens.Net, AppDimens.Net.Fluid, AppDimens.Net.Percent

Step 1 — Install

dotnet add package AppDimens.Net.WinUI

Step 2 — Initialize in App.OnLaunched

using AppDimens.Net.WinUI;

protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
    m_window = new MainWindow();
    AppDimensWinUI.Initialize(m_window);
    m_window.Activate();
}

Step 3 — XAML

<Page ...
      xmlns:ad="using:AppDimens.Net.WinUI">

    <StackPanel Padding="{ad:Sdp Value=16}" Spacing="{ad:Sdp Value=8}">
        <TextBlock Text="Hello" FontSize="{ad:Ssp Value=22}" />
        <Button Content="Save" Width="{ad:Sdp Value=120}" Height="{ad:Hdp Value=40}" />
        <Border Width="{ad:SpaceW Value=50}" Height="{ad:FSdp Value=80}" CornerRadius="{ad:Sdp Value=12}" />
    </StackPanel>
</Page>

WinUI markup extensions need Value=. Thickness, CornerRadius and GridLength are converted automatically. Before Initialize runs, values are used unscaled (no crash in the designer).

Step 4 — C#

using AppDimens.Net.Code.Scaled;
using AppDimens.Net.Code.Fluid;

saveButton.Width   = 120.Sdp();
titleText.FontSize = 22.Ssp();
AppDimensWinUI.Changed += (_, _) => titleText.FontSize = 22.Ssp();   // re-apply after resize

Which function?

Need Function XAML
Most sizes Sdp {ad:Sdp Value=16}
Follow height / width Hdp / Wdp {ad:Wdp Value=200}
Text Ssp {ad:Ssp Value=14}
Gentle growth on big windows FSdp {ad:FSdp Value=24}
Percent strategy / literal % PSdp / SpaceW, SpaceH {ad:SpaceW Value=50}

Converter for {Binding} / {x:Bind}: <ad:DimenConverter x:Key="Dimen" Function="Sdp" />.

Português (resumo)

dotnet add package AppDimens.Net.WinUI → em App.OnLaunched: AppDimensWinUI.Initialize(m_window); → no XAML xmlns:ad="using:AppDimens.Net.WinUI" e {ad:Sdp Value=16}, {ad:Ssp Value=14}. Em C#: 120.Sdp().

More: AppDimens.Net core · Repository

Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.19041 is compatible.  net9.0-windows was computed.  net9.0-windows10.0.19041 is compatible.  net10.0-windows was computed.  net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.6.1 83 10/12/2026