This is a Visual Studio code snippet definition for a WPF routed event.
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>eventr</Title>
<Shortcut>eventr</Shortcut>
<Description>Code snippet for a WPF Routed Event</Description>
<Author>Andrew Harcourt</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>eventName</ID>
<ToolTip>The name of the routed property (should *end* in ...Event).</ToolTip>
<Default>Stupid</Default>
</Literal>
<Literal Editable="false">
<ID>className</ID>
<ToolTip>The type of the owning class.</ToolTip>
<Function>ClassName()</Function>
<Default>StupidClass</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[#region $eventName$ Routed Event
public static readonly RoutedEvent $eventName$Event = EventManager.RegisterRoutedEvent(
"$eventName$",
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof($className$));
public event RoutedEventHandler $eventName$
{
add { AddHandler($eventName$Event, value); }
remove { RemoveHandler($eventName$Event, value); }
}
/// <summary>
/// Invoke this method when you wish to raise a(n) $eventName$ event
/// </summary>
private void Raise$eventName$Event()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs($className$.$eventName$Event);
RaiseEvent(newEventArgs);
}
#endregion]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>