Ziriax
Posts: 60
Joined: 10 Dec 2015, 17:59
Location: Belgium
Contact:

Re: [C++] Visual update on property changed

24 Feb 2017, 11:23

Thanks. And Item inherits from BaseComponent?
Peter Verswyvelen,
Strongly Typed Solutions
 
Ziriax
Posts: 60
Joined: 10 Dec 2015, 17:59
Location: Belgium
Contact:

Re: [C++] Visual update on property changed

24 Feb 2017, 11:44

Just one more question, you are using 1.3 RC1?
Peter Verswyvelen,
Strongly Typed Solutions
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: [C++] Visual update on property changed

25 Feb 2017, 01:57

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:
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");
  }
};
Could you please attach the xaml where you are binding to the IsChecked property?

Thanks.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 32 guests