Implements an HWND based host for XAML Islands. You can create a XamlWindow
from one of three overloads of XamlWindow::Make.
More...
#include <cppxaml/XamlWindow.h>
|
HWND | hwnd () const |
| returns the HWND backing the XamlWindow.
|
|
template<typename T = winrt::Windows::UI::Xaml::UIElement> |
T | GetUIElement () const |
| returns the XAML UI that the XamlWindow was created with.
|
|
std::wstring_view | Id () const |
| returns the window's id
|
|
HWND | Create (wchar_t const *szTitle, DWORD style, HWND parent=nullptr, int width=CW_USEDEFAULT, int height=CW_USEDEFAULT, int nCmdShow=SW_NORMAL) |
| Call this function to create the actual window. Afterwards, you will call XamlWindow::RunLoop to process window messages.
|
|
void | SetAcceleratorTable (HACCEL acc) |
|
AppController * | Controller () const |
|
int | RunLoop () |
|
|
template<typename TUIElement > |
static XamlWindow & | Make (std::wstring_view id, AppController *controller=nullptr) |
| Creates a window that hosts a XAML UI element.
|
|
static XamlWindow & | Make (std::wstring_view id, std::wstring_view markup, AppController *c=nullptr) |
| Creates a window that hosts XAML UI, based on some markup provided as an input parameter.
|
|
static XamlWindow & | Make (std::wstring_view id, winrt::Windows::UI::Xaml::UIElement(*getUI)(const XamlWindow &), AppController *c=nullptr) |
| Creates a window that hosts XAML UI. The UI will be provided by the app.
|
|
static XamlWindow & | Get (std::wstring_view id) |
| returns the XamlWindow corresponding to the id.
|
|
Implements an HWND based host for XAML Islands. You can create a XamlWindow
from one of three overloads of XamlWindow::Make.
◆ Controller()
◆ Create()
HWND cppxaml::XamlWindow::Create |
( |
wchar_t const * |
szTitle, |
|
|
DWORD |
style, |
|
|
HWND |
parent = nullptr , |
|
|
int |
width = CW_USEDEFAULT , |
|
|
int |
height = CW_USEDEFAULT , |
|
|
int |
nCmdShow = SW_NORMAL |
|
) |
| |
|
inline |
Call this function to create the actual window. Afterwards, you will call XamlWindow::RunLoop to process window messages.
- Parameters
-
szTitle | The window title. |
style | The window style. See Window styles and CreateWindow. |
parent | optional parent window. |
width | optional window width. |
height | optional window height. |
nCmdShow | Controls how the window is shown. See ShowWindow. |
- Returns
◆ Get()
static XamlWindow & cppxaml::XamlWindow::Get |
( |
std::wstring_view |
id | ) |
|
|
inlinestatic |
returns the XamlWindow corresponding to the id.
- Parameters
-
- Returns
◆ GetUIElement()
template<typename T = winrt::Windows::UI::Xaml::UIElement>
T cppxaml::XamlWindow::GetUIElement |
( |
| ) |
const |
|
inline |
returns the XAML UI that the XamlWindow was created with.
- Template Parameters
-
T | XAML type to cast to; defaults to UIElement. |
- Returns
◆ hwnd()
HWND cppxaml::XamlWindow::hwnd |
( |
| ) |
const |
|
inline |
◆ Id()
std::wstring_view cppxaml::XamlWindow::Id |
( |
| ) |
const |
|
inline |
returns the window's id
- Returns
◆ Make() [1/3]
template<typename TUIElement >
Creates a window that hosts a XAML UI element.
- Template Parameters
-
TUIElement | the XAML type to instantiate, usually a subclass of Page; this is usually defined by a separate WinRT Runtime component project, that the XAML Islands project references via C++/WinRT. |
- Parameters
-
- Returns
Usage:
auto& mainWindow = cppxaml::XamlWindow::Make<MarkupSample::MainPage>(L"MarkupSample", &controller);
◆ Make() [2/3]
static XamlWindow & cppxaml::XamlWindow::Make |
( |
std::wstring_view |
id, |
|
|
std::wstring_view |
markup, |
|
|
AppController * |
c = nullptr |
|
) |
| |
|
inlinestatic |
Creates a window that hosts XAML UI, based on some markup provided as an input parameter.
- Parameters
-
id | |
markup | XAML markup string to use to create the UI. |
c | |
- Returns
Usage:
<StackPanel>
<TextBlock>Hello</TextBlock>
</StackPanel>)", &controller);
static XamlWindow & Make(std::wstring_view id, AppController *controller=nullptr)
Creates a window that hosts a XAML UI element.
Definition: XamlWindow.h:114
◆ Make() [3/3]
static XamlWindow & cppxaml::XamlWindow::Make |
( |
std::wstring_view |
id, |
|
|
winrt::Windows::UI::Xaml::UIElement(*)(const XamlWindow &) |
getUI, |
|
|
AppController * |
c = nullptr |
|
) |
| |
|
inlinestatic |
Creates a window that hosts XAML UI. The UI will be provided by the app.
- Parameters
-
id | |
getUI | App-provided function to create UI. This can e.g. instantiate XAML types programmatically. |
c | |
- Returns
Usage:
◆ RunLoop()
int cppxaml::XamlWindow::RunLoop |
( |
| ) |
|
|
inline |
◆ SetAcceleratorTable()
void cppxaml::XamlWindow::SetAcceleratorTable |
( |
HACCEL |
acc | ) |
|
|
inline |
The documentation for this struct was generated from the following file: