﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>Attached Property</Title>
			<Shortcut>AttachedProp</Shortcut>
			<Description>Creates a WinUI attached property</Description>
			<Author>Samuel</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Declarations>
				<Literal>
					<ID>type</ID>
					<ToolTip>Property type</ToolTip>
					<Default>string</Default>
				</Literal>
				<Literal>
					<ID>property</ID>
					<ToolTip>Property name</ToolTip>
					<Default>Description</Default>
				</Literal>
				<Literal>
					<ID>owner</ID>
					<ToolTip>Owner type</ToolTip>
					<Default>MyAttachedProperties</Default>
				</Literal>
				<Literal>
					<ID>defaultValue</ID>
					<ToolTip>Default value</ToolTip>
					<Default>string.Empty</Default>
				</Literal>
			</Declarations>
			<Code Language="csharp">
				<![CDATA[
public static $type$ Get$property$(DependencyObject obj)
{
    return ($type$)obj.GetValue($property$Property);
}

public static void Set$property$(DependencyObject obj, $type$ value)
{
    obj.SetValue($property$Property, value);
}

public static readonly DependencyProperty $property$Property =
    DependencyProperty.RegisterAttached(
        "$property$",
        typeof($type$),
        typeof($owner$),
        new PropertyMetadata($defaultValue$));

$end$
]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>