wp7 – custom control project template

1 minute read

I couldn’t locate a Visual Studio project template for creating a windows phone 7 custom control library. So….I decided to make one. It is pretty straight-forward to create one by hand but the second time the process becomes a bit tedious..

Since it is practically the same as creating custom controls in wpf and silverlight it has been well documented. Here’s a clear and recent, phone-specific write-up http://www.windowsphonegeek.com/articles/7-Mistakes-Developer-make-when-implementing-Windows-Phone-Custom-Controls which points out some common errors.

Anyway, here’s the installation instructions:

  1. Find the folder used by visual studio for ‘user project templates location’ (Navigate to Tools > Options > Projects and Solutions and it will be in the right pane – see image below) and download and copy this zip file to that folder.
  2. Extract all files

 

blogcustomcontroltemplate

 

(This should result in a further zip file called ‘WP7 Custom Control’ being extracted to a subfolder called ‘Silverlight For Windows Phone’).

Next time you open the create new project dialog there should be an entry for a ‘Windows Phone Custom Control Library’  as shown below:

 

blogcustomcontroltemplate2

<p>&#160;</p>  <p>which, when selected will result in a project structure illustrated below..</p>  <p>&#160;</p>  <p><a href="/assets/images/2011/08/blogcustomcontroltemplate3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;padding-top:0;" title="blogcustomcontroltemplate3" border="0" alt="blogcustomcontroltemplate3" src="/assets/images/2011/08/blogcustomcontroltemplate3_thumb.png" width="377" height="268" /></a></p>    <p>&#160;</p>  <p>By the way, to create a project template simply create or locate a project to base the template on and select File &gt; Export Template in Visual Studio. See <a title="http://msdn.microsoft.com/en-us/magazine/cc188697.aspx" href="http://msdn.microsoft.com/en-us/magazine/cc188697.aspx">http://msdn.microsoft.com/en-us/magazine/cc188697.aspx</a> for further details.</p>  <p>&#160;</p>  <p>Technorati Tags: <a href="http://technorati.com/tags/windows phone" rel="tag">windows phone</a>,<a href="http://technorati.com/tags/wp7dev" rel="tag">wp7dev</a>,<a href="http://technorati.com/tags/custom control" rel="tag">custom control</a>,<a href="http://technorati.com/tags/template" rel="tag">template</a>,<a href="http://technorati.com/tags/Visual Studio" rel="tag">Visual Studio</a>,<a href="http://technorati.com/tags/library" rel="tag">library</a>,<a href="http://technorati.com/tags/Developer" rel="tag">Developer</a>,<a href="http://technorati.com/tags/Windows" rel="tag">Windows</a>,<a href="http://technorati.com/tags/templates" rel="tag">templates</a>,<a href="http://technorati.com/tags/Projects" rel="tag">Projects</a>,<a href="http://technorati.com/tags/Control" rel="tag">Control</a>    <br /></p>   Windows Live Tags: <a href="http://windows.live.com/connect/tag/windows phone" rel="clubhouseTag">windows phone</a>,<a href="http://windows.live.com/connect/tag/wp7dev" rel="clubhouseTag">wp7dev</a>,<a href="http://windows.live.com/connect/tag/custom control" rel="clubhouseTag">custom control</a>,<a href="http://windows.live.com/connect/tag/template" rel="clubhouseTag">template</a>,<a href="http://windows.live.com/connect/tag/Visual Studio" rel="clubhouseTag">Visual Studio</a>,<a href="http://windows.live.com/connect/tag/library" rel="clubhouseTag">library</a>,<a href="http://windows.live.com/connect/tag/Developer" rel="clubhouseTag">Developer</a>,<a href="http://windows.live.com/connect/tag/Windows" rel="clubhouseTag">Windows</a>,<a href="http://windows.live.com/connect/tag/templates" rel="clubhouseTag">templates</a>,<a href="http://windows.live.com/connect/tag/Projects" rel="clubhouseTag">Projects</a>,<a href="http://windows.live.com/connect/tag/Control" rel="clubhouseTag">Control</a>  <br />     WordPress Tags: <a href="http://wordpress.com/tag/windows phone" rel="Tag">windows phone</a>,<a href="http://wordpress.com/tag/wp7dev" rel="Tag">wp7dev</a>,<a href="http://wordpress.com/tag/custom control" rel="Tag">custom control</a>,<a href="http://wordpress.com/tag/template" rel="Tag">template</a>,<a href="http://wordpress.com/tag/Visual Studio" rel="Tag">Visual Studio</a>,<a href="http://wordpress.com/tag/library" rel="Tag">library</a>,<a href="http://wordpress.com/tag/Developer" rel="Tag">Developer</a>,<a href="http://wordpress.com/tag/Windows" rel="Tag">Windows</a>,<a href="http://wordpress.com/tag/templates" rel="Tag">templates</a>,<a href="http://wordpress.com/tag/Projects" rel="Tag">Projects</a>,<a href="http://wordpress.com/tag/Control" rel="Tag">Control</a>

Comments