PropertyMetadata - Property Changed Callback
Hi,
I have a DependencyProperty in my custom control that I am trying to register.
I want to supply the PropertyMetadata with this callback for when the property changes:
But when I compile, Noesis throws this error:
The property changed callback is the only important thing I need the metadata to have. Do I need to supply a ValueStorageManager?
Can someone share some examples of how this should look?
I'm using the Noesis 2.2 C++ SDK.
Thanks in advance :)
I have a DependencyProperty in my custom control that I am trying to register.
Code: Select all
static const DependencyProperty *SelectedItemsProperty;
Code: Select all
NS_IMPLEMENT_INLINE_REFLECTION(MultiSelectTreeView, TreeView)
{
NsMeta<TypeId>("Vital.MultiSelectTreeView");
DependencyData *data = NsMeta<DependencyData>(TypeOf<SelfClass>());
data->RegisterProperty<Ptr<ObservableCollection<BaseComponent>>>(SelectedItemsProperty, "SelectedItems",
PropertyMetadata::Create(&OnSelectedItemsChanged));
}
Code: Select all
void OnSelectedItemsChanged(BaseComponent *_sender, const DependencyPropertyChangedEventArgs &e);
NoesisSDK_2.2.0\Include\NsCore/TypeOfBase.inl(29,49): error C2825: 'T': must be a class or namespace when followed by '::'
I've tried calling a few different overloads of PropertyMetadata::Create, but cannot get it to work.NoesisSDK_2.2.0\Include\NsGui/PropertyMetadata.inl(18): message : see reference to class template instantiation 'Noesis::ValueStorageManagerImpl<T>' being compiled
The property changed callback is the only important thing I need the metadata to have. Do I need to supply a ValueStorageManager?
Can someone share some examples of how this should look?
I'm using the Noesis 2.2 C++ SDK.
Thanks in advance :)
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: PropertyMetadata - Property Changed Callback
Hi, the correct signature for the PropertyChangedCallback is:
Please let us know if you find any more problems.
Code: Select all
void PropertyChangedCallback(DependencyObject* d, const DependencyPropertyChangedEventArgs& e);
Re: PropertyMetadata - Property Changed Callback
I still get the same error(s) using that signature.Hi, the correct signature for the PropertyChangedCallback is:Please let us know if you find any more problems.Code: Select allvoid PropertyChangedCallback(DependencyObject* d, const DependencyPropertyChangedEventArgs& e);
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: PropertyMetadata - Property Changed Callback
Sorry for the late answer. The following code compiles fine with NoesisGUI 2.2 version:
Code: Select all
class MultiSelectTreeView : public TreeView
{
public:
static const DependencyProperty *SelectedItemsProperty;
private:
static void OnSelectedItemsChanged(DependencyObject* d, const DependencyPropertyChangedEventArgs& e)
{
}
NS_IMPLEMENT_INLINE_REFLECTION(MultiSelectTreeView, TreeView)
{
NsMeta<TypeId>("Vital.MultiSelectTreeView");
DependencyData *data = NsMeta<DependencyData>(TypeOf<SelfClass>());
data->RegisterProperty<Ptr<ObservableCollection<BaseComponent>>>(SelectedItemsProperty, "SelectedItems",
PropertyMetadata::Create(PropertyChangedCallback(OnSelectedItemsChanged)));
}
};
Re: PropertyMetadata - Property Changed Callback
Ah, that works.
The part that was not obvious to me was that OnSelectedItemsChanged needed to be wrapped in a PropertyChangedCallback inside PropertyMetadata::Create parameter.
As always, thanks a ton for the help!
The part that was not obvious to me was that OnSelectedItemsChanged needed to be wrapped in a PropertyChangedCallback inside PropertyMetadata::Create parameter.
As always, thanks a ton for the help!
Re: PropertyMetadata - Property Changed Callback
Thanks for the feedback. Also note that 2.2 is incredibly old, we recommend upgrading to 3.1
Re: PropertyMetadata - Property Changed Callback
We are currently in the discovery phase of what work it will take to upgrade our codebase to 3.1 in the next month or two, but we are very excited for it.
Thanks again for all that you guys do!
Thanks again for all that you guys do!
Who is online
Users browsing this forum: Google [Bot] and 81 guests