Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

RE: custom bubbled event registration

Closed Thread
 
Thread Tools Display Modes
Old 01-10-2006   #1 (permalink)
Wolf Schmidt [MSFT]
Guest


 

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,

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
types.custom.ps1xml for custom members hasten PowerShell 0 02-25-2008 08:30 PM
Scanner Event Registration Error Rich Bell Vista hardware & devices 2 11-29-2007 01:58 PM
How to assign a custom task to an event that has not yet occured SombreSire Vista performance & maintenance 0 08-08-2007 07:28 AM
Vista Event Viewer - Custom Views - RTM James Crown Vista account administration 0 12-19-2006 09:50 PM
Custom Dependency Property in custom class hierarchy not workingcorrectly?! MueMeister Avalon 0 03-02-2006 06:19 PM








Vistax64.com 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 2005-2008

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 47 48 49 50