|
CppXAML
|
The main CppXAML namespace. More...
Namespaces | |
| namespace | utils |
| Various utilities. | |
Classes | |
| struct | 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. More... | |
| struct | SimpleNotifyPropertyChanged |
| Helper base class to inherit from to have a simple implementation of INotifyPropertyChanged. More... | |
| struct | TypedXamlEvent |
| A default event handler that maps to Windows.Foundation.TypedEventHandler. More... | |
| struct | XamlEvent |
| A default event handler that maps to Windows.Foundation.EventHandler. More... | |
| struct | XamlProperty |
| Implements a simple property (without change notifications). More... | |
| struct | XamlPropertyWithNPC |
| Implements a property type with notifications. More... | |
| struct | XamlWindow |
Implements an HWND based host for XAML Islands. You can create a XamlWindow from one of three overloads of XamlWindow::Make. More... | |
Functions | |
| template<typename T > | |
| MakeContentControl (winrt::Windows::Foundation::IInspectable i) | |
Create a XAML element of a class that derives from ContentControl | |
| template<typename T > | |
| MakeContentControl (winrt::hstring v) | |
Create a XAML element of a class that derives from ContentControl by wrapping a string as its content. | |
| template<typename T > | |
| MakePanel (const std::initializer_list< cppxaml::xaml::UIElement > &elems) | |
Creates a XAML element of a type that is a subclass of Panel. | |
| template<typename C > | |
| auto | ContentDialog (C i) |
Creates a ContentDialog | |
| auto | StackPanel (const std::initializer_list< cppxaml::xaml::UIElement > &elems) |
Creates a StackPanel. | |
| template<typename TElements > | |
| Grid (details::GridRows gr, cppxaml::details::GridColumns gc, TElements &&elems) | |
Creates a Grid with the specified rows, columns, and children. | |
| auto | TextBox (std::wstring_view text=L"") |
Creates a TextBox | |
| template<typename T , typename TItems > | |
| MakeItemsControl (const TItems &items) | |
Creates a XAML element of a type that derives from ItemsControl | |
| template<typename TItems > | |
| auto | AutoSuggestBox (const TItems &svs) |
Creates an AutoSuggestBox from a list of items. | |
| TextBlock (std::wstring_view text) | |
Creates a TextBlock from its text content. | |
| template<typename C > | |
| auto | Button (C c) |
| Creates a Button. | |
| auto | FontIcon (std::wstring_view icon) |
| Creates a FontIcon from a string. | |
| auto | FontIcon (uint32_t glyph) |
| Creates a FontIcon from a glyph codepoint. | |
| auto | MenuFlyoutItem (std::wstring_view text) |
| Creates a MenuFlyoutItem with the specified text. | |
| template<typename... TMenuFlyoutItemBase> | |
| auto | MenuFlyout (TMenuFlyoutItemBase &&... items) |
Creates a MenuFlyout from a list of MenuFlyoutItems | |
| template<typename TWindow > | |
| void | InitializeWithWindow (winrt::Windows::Foundation::IInspectable obj, TWindow w) |
| Initializes an object with a window-like object. | |
| bool | InitializeWithWindow (winrt::Windows::Foundation::IInspectable obj, HWND hwnd) |
Initializes a FrameworkElement with an HWND. | |
| void | InitializeWithWindow (winrt::Windows::Foundation::IInspectable obj, const cppxaml::XamlWindow *xw) |
Initializes a FrameworkElement with the window represented by the XamlWindow or the XAML content root that the XamlWindow object is hosting. | |
| template<typename TUIElement , typename TWindow > | |
| void | InitializeWithWindow (cppxaml::details::Wrapper< TUIElement > obj, TWindow w) |
| template<typename T = cppxaml::xaml::DependencyObject> | |
| T | FindChildByName (cppxaml::xaml::DependencyObject d, std::wstring_view name) |
| Finds a XAML element by name. | |
| void | InitializeWinUI (uint8_t minorVersion=8) |
| Dynamically initializes WinUI 2. This API works on Windows 11 and newer. Adds the WinUI 2 framework package to the process's package graph. This enables unpackaged applications to use the stable (non-prerelease) WinUI 2 NuGet package. | |
| void | UninitializeWinUI () |
| Removes a reference to WinUI from the process's package graph. | |
The main CppXAML namespace.
| template< typename TItems > auto cppxaml::AutoSuggestBox | ( | const TItems & | svs | ) |
Creates an AutoSuggestBox from a list of items.
| TItems |
| svs | a list of wstring_view to populate the control from. |
| template< typename C > cppxaml::details::Wrapper< cppxaml::xaml::Controls::Button > cppxaml::Button | ( | C | c | ) |
Creates a Button.
| C | The type of the content to initialize the button with. |
| c | The content for the button, e.g. a string, a TextBlock, or a panel with some children, etc. |
| template< typename C > cppxaml::details::Wrapper< cppxaml::xaml::Controls::ContentDialog > cppxaml::ContentDialog | ( | C | i | ) |
Creates a ContentDialog
| C | Type of list of child controls |
| i | The list of child controls |
| T cppxaml::FindChildByName | ( | cppxaml::xaml::DependencyObject | d, |
| std::wstring_view | name | ||
| ) |
Finds a XAML element by name.
| T | Expected type of the element - defaults to DependencyObject. |
| d | XAML element object. |
| name | The name to search for. |
| auto cppxaml::FontIcon | ( | std::wstring_view | icon | ) |
Creates a FontIcon from a string.
| icon |
| auto cppxaml::FontIcon | ( | uint32_t | glyph | ) |
Creates a FontIcon from a glyph codepoint.
| glyph |
| cppxaml::Grid | ( | details::GridRows | gr, |
| cppxaml::details::GridColumns | gc, | ||
| TElements && | elems | ||
| ) |
Creates a Grid with the specified rows, columns, and children.
The row and column definitions are specified with the same syntax.
This will be either an initializer list where each element is a height (a double, or the strings "Auto", or "N*" where N is an integer), or a string with the corresponding format.
Example usage:
| gr | The set of grid row definitions. |
| gc | The set of grid column definitions. |
| elems | A list of cppxaml::details::UIElementInGrid entries where each entry is a {rowNumber, columnNumber, myUIElement} |
| void cppxaml::InitializeWinUI | ( | uint8_t | minorVersion = 8 | ) |
Dynamically initializes WinUI 2. This API works on Windows 11 and newer. Adds the WinUI 2 framework package to the process's package graph. This enables unpackaged applications to use the stable (non-prerelease) WinUI 2 NuGet package.
| minorVersion | Optional minor version. Defaults to 8 (for 2.8) |
| void cppxaml::InitializeWithWindow | ( | cppxaml::details::Wrapper< TUIElement > | obj, |
| TWindow | w | ||
| ) |
| TUIElement | |
| TWindow |
| obj | |
| w |
| void cppxaml::InitializeWithWindow | ( | winrt::Windows::Foundation::IInspectable | obj, |
| const cppxaml::XamlWindow * | xw | ||
| ) |
Initializes a FrameworkElement with the window represented by the XamlWindow or the XAML content root that the XamlWindow object is hosting.
| obj | |
| xw |
| bool cppxaml::InitializeWithWindow | ( | winrt::Windows::Foundation::IInspectable | obj, |
| HWND | hwnd | ||
| ) |
Initializes a FrameworkElement with an HWND.
| obj | |
| hwnd |
| void cppxaml::InitializeWithWindow | ( | winrt::Windows::Foundation::IInspectable | obj, |
| TWindow | w | ||
| ) |
Initializes an object with a window-like object.
| TWindow | the window-like type. In system XAML, it must have a XamlRoot. In WinUI 3, it must implement IWindowNative and have a Content property that exposes a XamlRoot (this will usually be Microsoft::UI::Xaml::Window). |
| obj | The object to attach to the window, e.g. a ContentDialog. |
| w | The window-like object. |
| cppxaml::MakeContentControl | ( | winrt::hstring | v | ) |
Create a XAML element of a class that derives from ContentControl by wrapping a string as its content.
| T | The XAML type, e.g. Button. |
| v | The string that will be set as the Content property. |
| cppxaml::MakeContentControl | ( | winrt::Windows::Foundation::IInspectable | i | ) |
Create a XAML element of a class that derives from ContentControl
| T | The XAML type, e.g. Button. Defaults to void. |
| i | The object that will be set as the Content property. |
| cppxaml::MakeItemsControl | ( | const TItems & | items | ) |
Creates a XAML element of a type that derives from ItemsControl
| T | The XAML type, e.g. AutoSuggestBox. |
| TItems | The type of the collection of items that might be used as seed to construct the control. For example, this could be a std::vector<std::wstring> that is used to construct the Items collection for an AutoSuggestBox.Defaults to void. |
| items | The list of items to initialize the control with. |
| cppxaml::MakePanel | ( | const std::initializer_list< cppxaml::xaml::UIElement > & | elems | ) |
Creates a XAML element of a type that is a subclass of Panel.
| T | The XAML type. |
| elems | The list of UIElements |
| auto cppxaml::MenuFlyout | ( | TMenuFlyoutItemBase &&... | items | ) |
Creates a MenuFlyout from a list of MenuFlyoutItems
| items |
| auto cppxaml::MenuFlyoutItem | ( | std::wstring_view | text | ) |
Creates a MenuFlyoutItem with the specified text.
| text |
| auto cppxaml::StackPanel | ( | const std::initializer_list< cppxaml::xaml::UIElement > & | elems | ) |
Creates a StackPanel.
| elems | The list of child controls. |
| cppxaml::TextBlock | ( | std::wstring_view | text | ) |
Creates a TextBlock from its text content.
| text | The text for the control. |
| auto cppxaml::TextBox | ( | std::wstring_view | text = L"" | ) |
Creates a TextBox
| text | The text to create the control from |