<?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>Define a RoutedEvent</Title> <Shortcut>revent</Shortcut> <Description>Code snippet for a event using RoutedEvent</Description> <Author>Nathan Zaugg</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>eventhandlertype</ID> <ToolTip>Event Handler Type Type</ToolTip> <Default>RoutedEventHandler</Default> </Literal> <Literal> <ID>name</ID> <ToolTip>Event Name</ToolTip> <Default>MyEvent</Default> </Literal> <Literal> <ID>ownerclass</ID> <ToolTip>The owning class of this Property.
Typically the class that it is declared in.</ToolTip> <Default>ownerclass</Default> </Literal> <Literal> <ID>routingstratigy</ID> <ToolTip>The routing stratigy for this event.</ToolTip> <Default>Bubble</Default> </Literal> </Declarations> <Code Language="csharp"> <![CDATA[ // Provide CLR accessors for the event public event RoutedEventHandler $name$ { add { AddHandler($name$Event, value); } remove { RemoveHandler($name$Event, value); } } // Using a RoutedEvent public static readonly RoutedEvent $name$Event = EventManager.RegisterRoutedEvent( "$name$", RoutingStrategy.$routingstratigy$, typeof($eventhandlertype$), typeof($ownerclass$)); $end$]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>