-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventattach.snippet
More file actions
60 lines (58 loc) · 2.04 KB
/
eventattach.snippet
File metadata and controls
60 lines (58 loc) · 2.04 KB
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
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2010/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>添付イベント</Title>
<Description>添付イベントを作成します。</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Shortcut>eventattach</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>eventName</ID>
<ToolTip>イベント名</ToolTip>
<Default>EventName</Default>
</Literal>
<Literal>
<ID>targetClass</ID>
<ToolTip>イベントの所有者クラス</ToolTip>
<Function>ClassName()</Function>
</Literal>
<Literal>
<ID>strategy</ID>
<ToolTip>ルーティング方法</ToolTip>
<Default>RoutingStrategy.Bubble</Default>
</Literal>
</Declarations>
<Code Language="csharp" Kind="method decl">
<![CDATA[/// <summary>
/// <c>$eventName$</c>添付イベントを識別します。
/// </summary>
public static readonly RoutedEvent $eventName$Event = EventManager.RegisterRoutedEvent(
"$eventName$",
$strategy$,
typeof(RoutedEventHandler),
typeof($targetClass$));
public static void Add$eventName$Handler(DependencyObject obj, RoutedEventHandler handler)
{
UIElement element = obj as UIElement;
if (element != null)
{
element.AddHandler($eventName$Event, handler);
}
}
public static void Remove$eventName$Handler(DependencyObject obj, RoutedEventHandler handler)
{
UIElement element = obj as UIElement;
if (element != null)
{
element.RemoveHandler($eventName$Event, handler);
}
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>