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:
NS_IMPLEMENT_REFLECTION(AquariumFilter)
{
NsMeta<TypeId>("AquariumFilter");
auto data = NsMeta<UIElementData>(TypeOf<SelfClass>());
data->RegisterEvent(NeedsCleaningEvent, "NeedsCleaning", RoutingStrategy_Bubble);
}
const RoutedEvent* AquariumFilter::NeedsCleaningEvent;
When used in xaml:
<aqua:Aquarium Name="theAquarium" Height="600" Width="800" aqua:AquariumFilter.NeedsCleaning="WashMe"/>
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:
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;
}
}