<?xml version="1.0" encoding="utf-8"?> 

<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> 
  <CodeSnippet Format="1.0.0"> 
    <Header> 
      <SnippetTypes> 
        <SnippetType>Expansion</SnippetType> 
      </SnippetTypes> 
      <Title>Define a DependencyProperty for Silverlight application</Title> 
      <Shortcut>propds</Shortcut> 
      <Description> 
        Code snippet for a property using DependencyProperty as the backing store and a Handler for the DependencyPropertyChanged event 
      </Description> 
      <Author>Tamir Khason</Author> 
    </Header> 
    <Snippet> 
      <Declarations> 
        <Literal Editable="true"> 
          <ID>type</ID> 
          <ToolTip>Property Type</ToolTip> 
          <Default>int</Default> 
          <Function> 
          </Function> 
        </Literal> 
        <Literal Editable="true"> 
          <ID>property</ID> 
          <ToolTip>Property Name</ToolTip>
          <Default>MyProperty</Default> 
          <Function> 
          </Function> 
        </Literal> 
        <Literal Editable="false"> 
          <ID>ownerclass</ID> 
          <ToolTip> 
            The owning class of this Property. Typically the class that it is declared in. 
          </ToolTip> 
          <Default>ClassNamePlaceholder</Default> 
          <Function>ClassName()</Function> 
        </Literal> 
      </Declarations> 
      <Code Language="csharp"> 
        <![CDATA[
#region $property$

/// <summary> 
/// Gets or sets the $property$ possible Value of the $type$ object.
/// </summary> 
public $type$ $property$ 
{ 
    get { return ($type$)GetValue($property$Property); } 
    set { SetValue($property$Property, value); } 
} 

/// <summary> 
/// Identifies the $property$ dependency property.
/// </summary> 
public static readonly DependencyProperty $property$Property = 
            DependencyProperty.Register(
                  "$property$", 
                  typeof($type$), 
                  typeof($ownerclass$), 
                  new PropertyMetadata(On$property$PropertyChanged)); 

/// <summary>
/// $property$Property property changed handler. 
/// </summary>
/// <param name="d">$ownerclass$ that changed its $property$.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param> 
private static void On$property$PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
{ 
  $ownerclass$ _$ownerclass$ = d as $ownerclass$; 
  if (_$ownerclass$!=null) 
  { 
    //TODO: Handle new value. 
  }
} 
#endregion $property$
$end$]]> 
      </Code> 
    </Snippet> 
  </CodeSnippet> 
</CodeSnippets>
