CppWinRT.Builders 0.0.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package CppWinRT.Builders --version 0.0.10                
NuGet\Install-Package CppWinRT.Builders -Version 0.0.10                
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="CppWinRT.Builders" Version="0.0.10" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CppWinRT.Builders --version 0.0.10                
#r "nuget: CppWinRT.Builders, 0.0.10"                
#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.
// Install CppWinRT.Builders as a Cake Addin
#addin nuget:?package=CppWinRT.Builders&version=0.0.10

// Install CppWinRT.Builders as a Cake Tool
#tool nuget:?package=CppWinRT.Builders&version=0.0.10                

CppWinRT.Builders

Add-on NuGet package to generate C++ builder-style helpers for WinRT objects.

Motivation

In C++/WinRT, setters are implemented as method calls that return void. This means that creating a button from code looks like:

  auto button = Controls::Button();
  button.Height(40);
  button.Width(200);
  button.Content(winrt::box_value(L"Hello"));

This can get repetitive, and some developers prefer a more fluent style. CppWinRT.Builders enables you to write this instead:

#include <winrt/builders/Windows.UI.Xaml.Controls.Button.h>
  auto button = Controls::builders::Button()
    .Height(40)
    .Width(200)
    .Content(winrt::box_value(L"Hello"));

Collections (such as types that derive from IVector<T> and IMap<T>) can also be initialized via C++ initializer lists:

  auto sp = Controls::builders::StackPanel{}
    .Children({
      Controls::builders::Button{}
        .Height(40)
        .Width(200)
        .Content(winrt::box_value(L"Hello")),
      Controls::builders::Button{}
        .Height(40)
        .Width(200)
        .Content(winrt::box_value(L"world")),
      })
    .Resources({
      { winrt::box_value(L"SomeKey"), winrt::box_value(42) }
      })
    .Background(Media::SolidColorBrush{ Windows::UI::Colors::AliceBlue() })
    .Padding(ThicknessHelper::FromUniformLength(8))
    .Orientation(Controls::Orientation::Horizontal);
Product Compatible and additional computed target framework versions.
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
0.0.14 503 10/21/2023
0.0.13 239 10/20/2023
0.0.12 484 1/29/2023
0.0.11 279 1/27/2023
0.0.10 267 1/26/2023
0.0.9 268 1/25/2023
0.0.8 364 12/19/2022
0.0.7 491 7/20/2022
0.0.6 429 7/19/2022
0.0.5 437 7/17/2022
0.0.4 452 7/17/2022
0.0.3 441 7/17/2022