Re: [C++] Visual update on property changed
Thanks. And Item inherits from BaseComponent?
Peter Verswyvelen,
Strongly Typed Solutions
Strongly Typed Solutions
Re: [C++] Visual update on property changed
Just one more question, you are using 1.3 RC1?
Peter Verswyvelen,
Strongly Typed Solutions
Strongly Typed Solutions
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: [C++] Visual update on property changed
Hi,
In the code you attached there are things I don't understand.
First you have a CheckItem inheriting from Item class but you're saying in reflection macros that it inherits from BaseComponent. Are you doing this because Item class doesn't include reflection macros? Is Item class inheriting from BaseComponent?
Then you have an Item_model inheriting from CheckItem class, and again you are saying in reflection macros that it inherits from BaseComponent, this doesn't seem right. You are also exposing the IsChecked property again, there is no need to do that unless getter/setters are different and you want to hide parent class property.
I think your classes should look something like this:
Could you please attach the xaml where you are binding to the IsChecked property?
Thanks.
In the code you attached there are things I don't understand.
First you have a CheckItem inheriting from Item class but you're saying in reflection macros that it inherits from BaseComponent. Are you doing this because Item class doesn't include reflection macros? Is Item class inheriting from BaseComponent?
Then you have an Item_model inheriting from CheckItem class, and again you are saying in reflection macros that it inherits from BaseComponent, this doesn't seem right. You are also exposing the IsChecked property again, there is no need to do that unless getter/setters are different and you want to hide parent class property.
I think your classes should look something like this:
Code: Select all
class Item: public BaseComponent {
...
NS_IMPLEMENT_INLINE_REFLECTION(Item, BaseComponent) { ... }
};
class CheckItem: public Item, public INotifyPropertyChanged {
...
NS_IMPLEMENT_INLINE_REFLECTION(CheckItem, Item) {
NsMeta<TypeId>("CheckItem");
NsImpl<INotifyPropertyChanged>();
NsProp("IsChecked", &CheckItem::GetIsChecked, &CheckItem::SetIsChecked);
}
};
class Item_model : public CheckItem {
...
NS_IMPLEMENT_INLINE_REFLECTION(Item_model, CheckItem) {
NsMeta<TypeId>("ListItem");
}
};
Thanks.
Who is online
Users browsing this forum: Ahrefs [Bot], jsantos and 1 guest