Unpackaged 0.0.4

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

// Install Unpackaged as a Cake Tool
#tool nuget:?package=Unpackaged&version=0.0.4                

CppXAML

CppXAML aims to make usage of XAML and XAML islands in C++ more natural and idiomatic.

C++/WinRT provides a projection of a Windws Runtime component's API, but one that isn’t always easy to use (esp. for XAML). It also is unopinionated w.r.t. how to implement properties. This added flexibility can be good, but is often unnecessary and results in overly-verbose code.

CppXAML provides the following higher-level helpers:

XamlWindow

XAMLWindow implements an HWND based host for XAML Islands. You can create a XamlWindow from one of three overloads of Make:

  1. Host a build-time XAML UIElement (usually defined in a runtime component project, often will be a Page) API:
    template<typename TUIElement>
    static XamlWindow& Make(PCWSTR id, AppController* controller = nullptr);
    
    Usage:
    auto& mainWindow = cppxaml::XamlWindow::Make<MarkupSample::MainPage>(L"MarkupSample", &controller);
    
  2. Host UI created from markup at runtime: API:
    static XamlWindow& Make(PCWSTR id, std::wstring_view markup, AppController* c = nullptr)
    
    Usage:
    auto& xw = cppxaml::XamlWindow::Make(L"MyPage", LR"(
      <StackPanel>
        <TextBlock>Hello</TextBlock>
      </StackPanel>)", &controller);
    
  3. Host UI created programmatically at runtime: API:
    static XamlWindow& Make(PCWSTR id, winrt::Windows::UI::Xaml::UIElement(*getUI)(const XamlWindow&), AppController* c = nullptr);
    
    Usage:
    auto& xw = cppxaml::XamlWindow::Make(L"Foo", [](auto&...) { 
      return winrt::Windows::UI::Xaml::Controls::Button(); 
    });
    

AppController

AppController is responsible for coordinating XamlWindow instances, can extend their wndproc, and provides an opportunity to hook up event handlers once a XAML UI becomes live

Property and event helpers

  • XamlProperty<T>
  • SimpleNotifyPropertyChanged<F>
  • XamlPropertyWithNPC<T>
  • XamlEvent<T>

These provide stock/simple property objects that remove the need for verbose hand-written options.

Examples:

MainPage.h:

cppxaml::XamlEvent<winrt::hstring> OkClicked;
cppxaml::XamlProperty<winrt::hstring> InterfaceStr;
cppxaml::XamlProperty<winrt::hstring> InterfaceStrWithNPC;

MainPage.cpp:

MainPage::MainPage() : INIT_PROPERTY(MyInt, 42)
{
    InitializeComponent();
    // Properties can be assigned to and read from with the operator= too!
    ImplString = winrt::hstring{ L"This string comes from the implementation" };
    winrt::hstring v = ImplString;
}
There are no supported framework assets in this 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
0.0.21 370 3/18/2023
0.0.20 403 11/14/2022
0.0.19 333 11/13/2022
0.0.18 329 11/12/2022
0.0.17 474 9/23/2022
0.0.16 10,960 1/8/2022
0.0.15 259 1/8/2022
0.0.13 261 1/7/2022
0.0.12 277 1/7/2022
0.0.11 260 1/4/2022
0.0.10 268 12/28/2021
0.0.9 278 12/27/2021
0.0.8 284 12/26/2021
0.0.7 265 12/23/2021
0.0.6 253 12/22/2021
0.0.5 266 12/22/2021
0.0.4 272 12/14/2021
0.0.3 273 12/8/2021
0.0.2 418 12/8/2021
0.0.1 542 8/27/2021