CppXAML
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cppxaml::SimpleNotifyPropertyChanged< T > Struct Template Reference

Helper base class to inherit from to have a simple implementation of INotifyPropertyChanged. More...

#include <cppxaml/XamlProperty.h>

Public Member Functions

auto RaisePropertyChanged (std::wstring_view name)
 Raises a property change notification event.
 

Detailed Description

template<typename T>
struct cppxaml::SimpleNotifyPropertyChanged< T >

Helper base class to inherit from to have a simple implementation of INotifyPropertyChanged.

Template Parameters
TCRTP type

When you declare your class, make this class a base class and pass your class as a template parameter:

struct MyPage : MyPageT<MyPage>, SimpleNotifyPropertyChanged<MyPage> {
MyPage() : INIT_PROPERTY(MyInt, 42) { }
};
#define INIT_PROPERTY(NAME, VALUE)
use this to initialize a cppxaml::XamlPropertyWithNPC in your class constructor.
Definition: XamlProperty.h:201
Helper base class to inherit from to have a simple implementation of INotifyPropertyChanged.
Definition: XamlProperty.h:78
Implements a property type with notifications.
Definition: XamlProperty.h:161

Member Function Documentation

◆ RaisePropertyChanged()

template<typename T >
auto cppxaml::SimpleNotifyPropertyChanged< T >::RaisePropertyChanged ( std::wstring_view  name)
inline

Raises a property change notification event.

Parameters
nameThe name of the property
Returns

Usage example
XAML file

<!-- XAML file... -->
<Image Source="ms-appx:///assets/skulogo2_client.png" Height="{x:Bind MyInt, Mode=OneWay}" />

C++

void MyPage::DoSomething() {
// modify MyInt
// MyInt = ...
// now send a notification to update the bound UI elements
}
auto RaisePropertyChanged(std::wstring_view name)
Raises a property change notification event.
Definition: XamlProperty.h:112

The documentation for this struct was generated from the following file: