SimpleWindow
载入中...
搜索中...
未找到
ObservableObject.h
1#pragma once
2
3#include "INotifyObjectDead.h"
4#include "INotifyPropertyChanged.h"
5
6namespace sw
7{
12 public INotifyObjectDead,
14 {
15 protected:
21 {
22 if (PropertyChanged) {
23 PropertyChanged(*this, propertyId);
24 }
25 }
26
33 template <typename T, typename TProperty>
34 void RaisePropertyChanged(TProperty T::*property)
35 {
36 FieldId id = Reflection::GetFieldId(property);
38 }
39 };
40}
动态对象基类
Definition Reflection.h:26
对象销毁通知接口
Definition INotifyObjectDead.h:18
属性变更通知接口
Definition INotifyPropertyChanged.h:18
PropertyChangedEventHandler PropertyChanged
当属性值更改时触发的事件
Definition INotifyPropertyChanged.h:23
可观察对象基类,实现属性更改通知功能
Definition ObservableObject.h:14
void RaisePropertyChanged(TProperty T::*property)
触发属性更改通知事件
Definition ObservableObject.h:34
void RaisePropertyChanged(FieldId propertyId)
触发属性更改通知事件
Definition ObservableObject.h:20
static FieldId GetFieldId(TField T::*field) noexcept
获取字段的唯一标识符
Definition Reflection.h:237
表示字段的唯一标识符
Definition Reflection.h:177