Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - RE: custom bubbled event registration

 
 
Old 01-10-2006   #1 (permalink)
Wolf Schmidt [MSFT]


 
 

RE: custom bubbled event registration

I'm somewhat confused by your terminology.
The "owner" of a routed event is provided when you register it. Which
elements can raise the event is part of the class hierarchy, not determined
by the element tree.
We don't usually think of elements that raise the events as being the
"owners" because an owner is a Type. I wasn't sure if that was what you were
implying.
The EventManager.RegisterRoutedEvent call is supposed to be within a class'
definition of its members. The return value of registering a routed event
should then be established as a static readonly field on the class (probably
a public one, if you intend other people's code to be able to handle your
event).
If you have a scenario where you want to have arbitrary elements regardless
of their hierarchy raise an event to be handled at or near your application
root, it's possible that an attached event is actually what you want to
declare here.

"Pichichi" wrote:

> I need to register the same custom routed event from multiple child elements
> in an application. The event has a custom signature [handle], and I want it
> to be able to bubble all the way up to the root of the app domain.
> Unfortunately the only examples I have found of such custom events are
> trivial. In these cases, the event sits in one window thus is published from
> there as "owner", and only one consumer [subscriber] of the event registers
> up the tree from the owner. This example is clear but not thorough.
>
> My question more specifically is where to add the
> EventManager.RegisterRoutedEvent logic. If there are multiple "owners" at
> the lowest level of the tree, does each one of them have to register their
> implementation of the event as a RoutedEvent, or can I just add one
> registration of the event at the root level with the application as "owner"?
> If the latter, will the event actually bubble since there is no element
> higher than the root? I am not sure if "owner" parm on RegisterRoutedEvent
> determines the ability of the event itself to bubble (or tunnel if the event
> needed that behavior instead).
>
> Best regards,


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Event handlers on nested custom controls in WPF .NET General
Create Custom Event Source by turning UAC ON in Windows VISTA Vista security
Scanner Event Registration Error Vista hardware & devices
How to assign a custom task to an event that has not yet occured Vista performance & maintenance
Vista Event Viewer - Custom Views - RTM Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46