Command binding doens't work C++
Posted: 05 May 2021, 10:36
Hey, I made method and NsProp'ed this, then I use command in .xaml and I was surprised becouse it didn't work.
Could you help?
And this is what I have in Button
Have u idea why?
Could you help?
Code: Select all
Test::Test()
{
_backClicked.SetExecuteFunc(MakeDelegate(this, &Test::OnBack));
Initialized() += MakeDelegate(this, &Test::OnInitialized);
InitializeComponent();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Test::InitializeComponent()
{
GUI::LoadComponent(this, "Test.xaml");
}
void OurMenu::Test::OnInitialized(Noesis::BaseComponent *, const Noesis::EventArgs &)
{
rootContent = FindName<ContentControl>("RootContent");
}
const NoesisApp::DelegateCommand * OurMenu::Test::GetBackDelegate() const
{
return &_backClicked;
}
void OurMenu::Test::OnBack(BaseComponent * param)
{
NS_UNUSED(param);
MessageBox(0, 0, "Back", 0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
NS_BEGIN_COLD_REGION
NS_IMPLEMENT_REFLECTION(OurMenu::Test, "OurMenu.Test")
{
NsProp("OnBack", &Test::GetBackDelegate);
NS_UNUSED(helper);
}
Code: Select all
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding OnBack}"/>
</i:EventTrigger>
</i:Interaction.Triggers>