---
title: "Resharper template for DependencyProperty in silverlight"
url: "https://osherove.com/blog/2009/5/27/resharper-template-for-dependencyproperty-in-silverlight.md"
canonical: "https://osherove.com/blog/2009/5/27/resharper-template-for-dependencyproperty-in-silverlight.html"
published: "2009-05-27T04:15:30"
updated: "2009-05-27T04:15:30"
tags: ["Silverlight"]
author: "Roy Osherove"
description: "Here’s a much better DependencyProperty snipper for Silverlight custom controls that can be used with resharper: #region $PROPNAME$ Property public $PROPTYPE$ $PROPNAME$ { get { return ($PROPTYPE$)…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Resharper template for DependencyProperty in silverlight

By Roy Osherove May 27, 2009 In [Silverlight](https://osherove.com/blog/category/silverlight)

**Historical article** · Originally published May 27, 2009; technical details may be outdated.

Here’s a much better DependencyProperty snipper for Silverlight custom controls that can be used with resharper:

        #region $PROPNAME$ Property
        public $PROPTYPE$ $PROPNAME$
        {
            get { return ($PROPTYPE$) GetValue($PROPNAME$Property); }
            set { SetValue($PROPNAME$Property,value); }
        }

        public static readonly DependencyProperty $PROPNAME$Property =
                                            DependencyProperty.Register(
            "$PROPNAME$", typeof ($PROPTYPE$), typeof ($DECLARING\_TYPE$),
            new PropertyMetadata($DEF\_VALUE$ , On$PROPNAME$Changed ));

        private static void On$PROPNAME$Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            $DECLARING\_TYPE$ $DECLARING\_TYPE\_var$ = d as $DECLARING\_TYPE$;
            $END$
        }
        #endregion

## More in Silverlight

[All posts in Silverlight](https://osherove.com/blog/category/silverlight)

- Jun 2, 2009

    ### [Upcoming SilverUnit Preview](https://osherove.com/blog/2009/6/2/upcoming-silverunit-preview.html)

- May 27, 2009

    ### [A simpler, conventions based DependencyProperty structure for silverlight using CustomControlBase](https://osherove.com/blog/2009/5/27/a-simpler-conventions-based-dependencyproperty-structure-for.html)

- May 27, 2009

    ### [Fix: Requested registry access is not allowed error when creating silverlight project in visual studio 2008](https://osherove.com/blog/2009/5/27/fix-requested-registry-access-is-not-allowed-error-when-crea.html)

- May 23, 2009

    ### [SilverUnit Project Template and new version](https://osherove.com/blog/2009/5/23/silverunit-project-template-and-new-version.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
