Is Attached Event supported ?
Hi,
Does NoesisGUI support Attached Event ?
Ref: https://docs.microsoft.com/en-us/dotnet ... s-overview
Does NoesisGUI support Attached Event ?
Ref: https://docs.microsoft.com/en-us/dotnet ... s-overview
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Is Attached Event supported ?
It could be done if you are using C++ SDK.
You would need the UIElementData class to register your custom RoutedEvent inside the reflection block of your class:
When used in xaml:
Code-behind is responsible to make the event and handler connection as explained here: http://www.noesisengine.com/docs/Gui.Co ... connection
Inside the Connect method you will make use of the static methods defined in AquariumFilter to hook the event handler:
You would need the UIElementData class to register your custom RoutedEvent inside the reflection block of your class:
Code: Select all
NS_IMPLEMENT_REFLECTION(AquariumFilter)
{
NsMeta<TypeId>("AquariumFilter");
auto data = NsMeta<UIElementData>(TypeOf<SelfClass>());
data->RegisterEvent(NeedsCleaningEvent, "NeedsCleaning", RoutingStrategy_Bubble);
}
const RoutedEvent* AquariumFilter::NeedsCleaningEvent;
Code: Select all
<aqua:Aquarium Name="theAquarium" Height="600" Width="800" aqua:AquariumFilter.NeedsCleaning="WashMe"/>
Inside the Connect method you will make use of the static methods defined in AquariumFilter to hook the event handler:
Code: Select all
void Connect(Noesis::BaseComponent* source, const NsChar* eventName, const NsChar* handlerName)
{
if (String::Compare(eventName, "NeedsCleaning") == 0 &&
String::Compare(handlerName, "WashMe") == 0)
{
AquariumFilter::AddNeedsCleaningHandler((DependencyObject*)source, MakeDelegate(this, &AquariumPage::WashMe));
return;
}
}
Re: Is Attached Event supported ?
Yes, I think that works. Thanks !
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Is Attached Event supported ?
Great, marking it as solved.
Who is online
Users browsing this forum: Bing [Bot] and 86 guests