Accessing List of reflected properties added with NSProp
Hello,
I am trying to write a generic behavior and I would need to go trough in reflected properties of ViewModel of attached control.
In this example, how can I get "Name" and "Age" property names and how can I query the value of this properties.
I wrote the similar idea with C# and it is working. When I tried the same idea with c++ BaseComponent::GetDataContext()::GetClassType(), (in this case DataContext is PersonViewModel)I do not see these properties that I added with NsProp.
I am trying to write a generic behavior and I would need to go trough in reflected properties of ViewModel of attached control.
Code: Select all
NS_IMPLEMENT_REFLECTION(PersonViewModel)
{
NSProp("Name", &PersonViewModel::GetName);
NSProp("Age", &PersonViewModel::GetAge);
}
I wrote the similar idea with C# and it is working. When I tried the same idea with c++ BaseComponent::GetDataContext()::GetClassType(), (in this case DataContext is PersonViewModel)I do not see these properties that I added with NsProp.
Re: Accessing List of reflected properties added with NSProp
Ok, What I was doing was correct. GetClassType() is indeed giving properties that are added with NsProp.
My mistake was calling TypeClass::GetProperty(uint32_t index) with Noesis::Symbol. Since it is not explicit method it was accepting the parameter.
I should be calling TypeClass::FindProperty(Symbol name).
My mistake was calling TypeClass::GetProperty(uint32_t index) with Noesis::Symbol. Since it is not explicit method it was accepting the parameter.
I should be calling TypeClass::FindProperty(Symbol name).
Re: Accessing List of reflected properties added with NSProp
Yes, as you discovered, TypeClass exposes everything declared using macros. Great to know you solved the issue.
Who is online
Users browsing this forum: Google [Bot] and 64 guests