Implementing Custom Markup Extension in C++
Posted: 14 Aug 2017, 07:33
Hi, sorry, I am stucked again when trying to translate the following WPF Markup extension code:
#original code is here: http://www.mobilemotion.eu/?p=1837 XAML
I tried to create an EventBindingExtension class inheriting from BaseComponent and IMarkupExtension as follows (still empty).
When I ran the code (just to make sure NoesisGUI can find EventBindingExtension class and instatiate it), NoesisGUI complained with the following error:
If possible, could you show me the full C++ version of the EventBindingExtension ?
Thanks.
#original code is here: http://www.mobilemotion.eu/?p=1837 XAML
Code: Select all
<Grid Background="White" MouseDown="{local:EventBinding MouseDownCommand}">
</Grid>
Code: Select all
class EventBindingExtension : public BaseComponent, public IMarkupExtension
{
public:
EventBindingExtension() {
}
EventBindingExtension(const NsChar * command) {
}
virtual Ptr<Core::BaseComponent> ProvideValue(const void* context) override {
return nullptr;
}
NS_IMPLEMENT_INTERFACE_FIXUP
NS_IMPLEMENT_INLINE_REFLECTION(EventBindingExtension, BaseComponent)
{
NsMeta<TypeId>("EventBinding");
}
};
Debugging showed that NoesisGUI instantiated EventBindingExtension using the default constructor, while I am expecting it used the second constructor. Do I have to register the second constructor ? How should I do that ? I have tried to comb through the reflection related headers to find APIs to register constructor but couldn't find ones. And documentation is still showing old (pre 2.0) APis (NsCtr).Gui\Core\Src\XamlNode.cpp:573:Can't convert 'MouseDownCommand' into a 'EventBinding' object (@10,4)
If possible, could you show me the full C++ version of the EventBindingExtension ?
Thanks.