Page 1 of 1

Events in C++

Posted: 19 Apr 2021, 14:54
by BartekW
Hey, I want to create static events and pass Noesis::Key and I dont know how to make it

I declared
static Noesis::Delegate<Noesis::Key>& KeyDownTest;
But I don't know how to fire it and how to add my method to it, please any example?

Or maybe how I can reach KeyDown/Up events if my class is inheriting NoesisApp::NotifyPropertyChangedBase?

Re: Events in C++

Posted: 19 Apr 2021, 16:28
by jsantos
Events Tutorial
Or maybe how I can reach KeyDown/Up events if my class is inheriting NoesisApp::NotifyPropertyChangedBase?
Please, read carefully the tutorial to connect to any event exposed in XAML.

Re: Events in C++

Posted: 19 Apr 2021, 17:14
by BartekW
Ok Thanks I understand. Now I have mindfuck. If I have class MainMenu in C++ and its connected to .xaml how and where the object is created and how I can access to him?

Re: Events in C++

Posted: 27 Apr 2021, 20:15
by sfernandez
The MainMenu object is created when the xaml gets loaded, the XAML parser creates the class referenced by x:Class attribute.
You can access it from the MainMenu code-behind itself, or if it is part of another xaml, you can name the MainMenu element in that xaml and use FindName to get a reference (from the parent xaml code-behind).