<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Karl On WPF - .Net</title>
	<atom:link href="http://karlshifflett.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://karlshifflett.wordpress.com</link>
	<description>The Home of Mole and Karl&#039;s BLOG on WPF &#38; VB.NET.  (Karl speaks VB, learning C#)</description>
	<lastBuildDate>Sat, 21 Nov 2009 04:13:33 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='karlshifflett.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/fd6473d2122f8fd11e40fd5404a1a9c5?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Karl On WPF - .Net</title>
		<link>http://karlshifflett.wordpress.com</link>
	</image>
			<item>
		<title>Extensibility Series &#8211; WPF &amp; Silverlight Design-Time Code Sharing &#8211; Part I</title>
		<link>http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/</link>
		<comments>http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 04:12:31 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Cider Designer]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Extensibility]]></category>
		<category><![CDATA[Extensibility Series]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight Controls]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF Controls]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/</guid>
		<description><![CDATA[This is the first in series of posts called the “Extensibility Series.”&#160; This series will cover writing design-times for WPF &#38; Silverlight custom controls for the WPF &#38; Silverlight Designer for Visual Studio 2010 that target .NET 4.0 and Silverlight 3 and 4.&#160; I will use the term Designer for the rest of this article.
Normally [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1187&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is the first in series of posts called the “Extensibility Series.”&#160; This series will cover writing design-times for WPF &amp; Silverlight custom controls for the WPF &amp; Silverlight Designer for Visual Studio 2010 that target .NET 4.0 and Silverlight 3 and 4.&#160; I will use the term Designer for the rest of this article.</p>
<p>Normally in a series you start with a simple example and article.&#160; For this series I need to start with a level 300-400 example because this article and code is for the Development Tools Ecosystem Summit presentation that Mark Boulter and I did.</p>
<p>The presentation was on how to write a design-time assembly that could be shared between WPF and Silverlight custom controls.</p>
<p>Part I of this post covers Feedback and Rating control, design-time assembly discovery, loading and metadata creation.</p>
<p>Part II of this post will cover the control design-time code. (coming after Thanksgiving break)</p>
<p>The code in this post is C#.&#160; (Yes… Karl is now a member of the dark side, but will remain faithful to the bright side.)&#160; The example code is C#.&#160; I will post VB.NET example code after the Thanksgiving break.</p>
<h4>Tutorial Breadcrumb Trail</h4>
<p>When you open the source code solution, be sure to open your Task List window so that you can view and walk the step by step tutorial breadcrumb trail I’ve added to the solution.&#160; When you click on each TODO you’ll be taken to that section of code.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/breadcrumbtrail.png"><img style="display:inline;border-width:0;" title="BreadcrumbTrail" border="0" alt="BreadcrumbTrail" src="http://karlshifflett.files.wordpress.com/2009/11/breadcrumbtrail_thumb.png?w=668&#038;h=227" width="668" height="227" /></a> </p>
<h4>Background</h4>
<p>For the purpose of this article and the code, our fictitious company name is, Cider Controls.&#160; The first control we have ready for release is our WPF &amp; Silverlight Feedback control.&#160; The Feedback control contains our Rating control that allows a value to be selected at run-time using the mouse.&#160; Our assignment is to write a design-time for Visual Studio 2010 for this control.</p>
<p>Note: Setting the rating value at design-time is probably something the control does not actually need.&#160; However, it serves its purpose by illustrating how to use the extensibility features of the Designer. </p>
<h4>WPF &amp; Silverlight Feedback Control</h4>
<table border="0" cellspacing="10" cellpadding="5">
<tbody>
<tr>
<td valign="top"><a href="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrol.png"><img style="display:inline;border-width:0;" title="FeedbackControl" border="0" alt="FeedbackControl" src="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrol_thumb.png?w=317&#038;h=189" width="317" height="189" /></a> </td>
<td valign="top"><a href="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrolclassdiagram.png"><img style="display:inline;border-width:0;" title="FeedbackControlClassDiagram" border="0" alt="FeedbackControlClassDiagram" src="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrolclassdiagram_thumb.png?w=190&#038;h=288" width="190" height="288" /></a> </td>
</tr>
</tbody>
</table>
<p>The blue text is the Header property.&#160; This property is of type Object.&#160; Developers can supply simple text or use nested XAML to create any type of Header they want.</p>
<p>The text under the Header is the CommentHeading property which is a String.</p>
<p>The TextBox is bound to the Comment property which is a String.</p>
<p>The <strong><font size="5">. . . . .</font></strong> is the Rating control.&#160; This is bound to the Value property which is an Integer.</p>
<p>The CornerRadius property binds to the Border control in the control template.</p>
<p>The Submit Button is enabled when the Value is greater than zero and the Comment is not empty or null.</p>
<h4>Required Design-Time Features</h4>
<ul>
<li>Support both the WPF &amp; Silverlight versions of the Feedback control </li>
<li>Set control value at design-time using a context menu </li>
<li>Set control value at design-time using the Rating control in an adorner </li>
<li>Set control value at design-time using the Rating control is the properties window </li>
<li>Set all control properties in the properties window </li>
<li>Provide a Category Editor for the properties window that allows editing the Feedback control properties assigned to the Custom category </li>
</ul>
<h5>Features</h5>
<h6>Menu Action</h6>
<p>The Feedback Value property is zero.&#160; </p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/menuaction.png"><img style="display:inline;border-width:0;" title="MenuAction" border="0" alt="MenuAction" src="http://karlshifflett.files.wordpress.com/2009/11/menuaction_thumb.png?w=443&#038;h=497" width="443" height="497" /></a></p>
<h6>Adorner</h6>
<p>After the Feedback Value property has been set, both the control and adorner display the value.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/adorner.png"><img style="display:inline;border-width:0;" title="Adorner" border="0" alt="Adorner" src="http://karlshifflett.files.wordpress.com/2009/11/adorner_thumb.png?w=373&#038;h=281" width="373" height="281" /></a> </p>
<h6>Inline Value Editor</h6>
<p>Inline Value editor uses the Rating control just like the Feedback control and adorner.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/valueeditor.png"><img style="display:inline;border-width:0;" title="ValueEditor" border="0" alt="ValueEditor" src="http://karlshifflett.files.wordpress.com/2009/11/valueeditor_thumb.png?w=381&#038;h=109" width="381" height="109" /></a></p>
<h6>Category Editor</h6>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/categoryview.png"><img style="display:inline;border-width:0;" title="CategoryView" border="0" alt="CategoryView" src="http://karlshifflett.files.wordpress.com/2009/11/categoryview_thumb.png?w=382&#038;h=193" width="382" height="193" /></a>&#160; </p>
<h6>Design-time XAML</h6>
<p>Notice the Feedback Header that takes XAML.&#160; You could easily add a Grid or StackPanel and then display and image and text if you wanted.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">cc</span><span style="color:blue;">:</span><span style="color:#a31515;">Feedback
    </span><span style="color:red;">HorizontalAlignment</span><span style="color:blue;">=&quot;Left&quot; </span><span style="color:red;">Grid.Column</span><span style="color:blue;">=&quot;1&quot;
    </span><span style="color:red;">VerticalAlignment</span><span style="color:blue;">=&quot;Top&quot; </span><span style="color:red;">Height</span><span style="color:blue;">=&quot;176&quot; </span><span style="color:red;">Width</span><span style="color:blue;">=&quot;304&quot;
    </span><span style="color:red;">CommentHeading</span><span style="color:blue;">=&quot;Write a design time for your control today.&quot;
    </span><span style="color:red;">CornerRadius</span><span style="color:blue;">=&quot;10&quot;
    </span><span style="color:red;">Padding</span><span style="color:blue;">=&quot;3&quot;
    </span><span style="color:red;">BorderBrush</span><span style="color:blue;">=&quot;DarkGray&quot;
    </span><span style="color:red;">BorderThickness</span><span style="color:blue;">=&quot;3&quot;
    </span><span style="color:red;">Background</span><span style="color:blue;">=&quot;WhiteSmoke&quot; </span><span style="color:red;">Value</span><span style="color:blue;">=&quot;3&quot; </span><span style="color:red;">Margin</span><span style="color:blue;">=&quot;12,24,0,0&quot;&gt;

    &lt;</span><span style="color:#a31515;">cc</span><span style="color:blue;">:</span><span style="color:#a31515;">Feedback.Header</span><span style="color:blue;">&gt;
        &lt;</span><span style="color:#a31515;">TextBlock
            </span><span style="color:red;">Foreground</span><span style="color:blue;">=&quot;Blue&quot; </span><span style="color:red;">FontSize</span><span style="color:blue;">=&quot;16&quot; </span><span style="color:red;">FontWeight</span><span style="color:blue;">=&quot;Bold&quot;
            </span><span style="color:red;">Text</span><span style="color:blue;">=&quot;Control Design Time Example&quot; /&gt;
    &lt;/</span><span style="color:#a31515;">cc</span><span style="color:blue;">:</span><span style="color:#a31515;">Feedback.Header</span><span style="color:blue;">&gt;

&lt;/</span><span style="color:#a31515;">cc</span><span style="color:blue;">:</span><span style="color:#a31515;">Feedback</span><span style="color:blue;">&gt;

</span></pre>
</div>
<h4>Design-Time Assembly Locating</h4>
<p>Writing a design-time for a control is actually pretty simple and the code tends to be small blocks since each individual feature you add is almost self-contained.</p>
<p>There are two complicated pieces, metadata loading and Toolbox installation.&#160; </p>
<p>Simplified:&#160; Metadata loading is the design-time process that Visual Studio uses to discover and associate your design-time code with your control so that the Designer will run it at design-time when you want it to.</p>
<p>I’ll cover Toolbox installation in my next Extensibility Series post.</p>
<p>These two can be complicated because there are different ways to do both, some can involve the registry, some involve multiple assemblies and both depend on a naming convention.&#160; In other words, when you first look at this, you’ll think there are a number of moving parts, but after you’ve done this a few times, you’ll have it down.</p>
<h5>Design-Time Load Scenarios</h5>
<ul>
<li>WPF Custom Control Designer &#8211; (single design assembly) </li>
<li>Silverlight Custom Control Designer &#8211; (single or two design assemblies) </li>
<li>Code Sharing for WPF &amp; Silverlight controls (five design assemblies) </li>
</ul>
<p><strong>Note</strong>:&#160; You can use other techniques for reducing the number of assemblies when doing multi-platform design-times, but they can lead to bugs and confusion due to platform mixing and won’t be discussed here.</p>
<p>For this post I’ll only cover the, “Code Sharing for WPF &amp; Silverlight controls” scenario.&#160; The techniques that I’ll describe here are used in Microsoft production code and simplify code sharing.&#160; In future posts I’ll cover the other design-time load scenarios and techniques.</p>
<h5>Design-Time Assembly Naming and Location</h5>
<table border="1" cellspacing="1" cellpadding="3">
<tbody>
<tr>
<td valign="top"><strong>Assembly name</strong></td>
<td valign="top"><strong>Notes</strong></td>
</tr>
<tr>
<td valign="top">CiderControls.WPF.dll</td>
<td valign="top">Custom Control Run-Time Assembly</td>
</tr>
<tr>
<td valign="top">CiderControls.WPF.Design.*.dll</td>
<td valign="top">Loaded by Visual Studio and Blend</td>
</tr>
<tr>
<td valign="top">\Design\CiderControls.WPF.Design.*.dll</td>
<td valign="top">Located in the \Design sub folder.&#160; Loaded by Visual Studio and Blend</td>
</tr>
<tr>
<td valign="top">CiderControls.WPF.VisualStudio.Design.*.dll</td>
<td valign="top">Loaded only by Visual Studio</td>
</tr>
<tr>
<td valign="top">CiderControls.WPF.Expression.Design.*.dll</td>
<td valign="top">Loaded only by Blend</td>
</tr>
<tr>
<td valign="top">\Design\CiderControls.WPF.VisualStudio.Design.*.dll</td>
<td valign="top">Loaded only by Visual Studio</td>
</tr>
<tr>
<td valign="top">\Design\CiderControls.WPF.Expression.Design.*.dll</td>
<td valign="top">Loaded only by by Blend</td>
</tr>
</tbody>
</table>
<p>Looking closely at the above table, you’ll see a naming pattern.&#160; The control assembly can be named whatever the control author wants.&#160; Typically you’ll see the vendor name followed by the product and possibly version number. </p>
<p>The design-time assemblies must be named according to the above table in order for Visual Studio to load them.</p>
<p>For metadata loading Visual Studio loads the .dll’s in the above order.&#160; Meaning .VisualStudio.Design. qualified .dll’s will load second and overwrite metadata in the .Design dll. </p>
<p>The “*” represents optional additional name text that the design-time assembly author can add.&#160; Normally this is not used.&#160; This provides a way to ship additional design assemblies that follow the above naming convention.&#160; (See next paragraph.)</p>
<p>When the metadata is loaded there is one more consideration that is taken into account.&#160; The version number of the Microsoft.Windows.Design.Extensibility.dll or Microsoft.Windows.Design.Interaction.dll that the design-time assembly is compiled against will be compared to those versions on the target machine.</p>
<p>For readability I’ll use MWD in place of Microsoft.Windows.Design.Extensibility.dll in the next short section.</p>
<p>The Design.*.dll nomenclature allows for multiple design assemblies fitting a pattern such as “foo.Design.*.dll”, one for each version of the MWD interface.&#160; Zero or one assembly fitting a pattern will load: </p>
<ul>
<li>If the MWD version referenced by the design-time assembly has a different major version number than the user’s machine MWD version, then the design-time assembly will not load and is bypassed. </li>
<li>If more than one design-time assembly is compatible with the user’s machine MWD version, the Designer loads the version compiled against the highest MWD version that is less than or equal to the user’s machine MWD version. </li>
</ul>
<p>For instance, if the user’s machine MWD version is 4.1.3.0 and there are 4 design-time assemblies matching the pattern “foo.design*.dll”, each compiled against the below MWD versions, the designer reacts as follows: </p>
<ul>
<li>3.0.1.0: Will not load.&#160; Incompatible API version. </li>
<li>4.0.1.0: Would load if there were not a higher matching version, but since 4.1.1.0 exists it does not load&#160; </li>
<li>4.1.1.0: Version loaded as it is closest to the current version number without exceeding it </li>
<li>4.3.0.0: Will not load in the Designer as it was built against a newer version of the MWD’s </li>
</ul>
<h5>Metadata and Design Code</h5>
<p>The design-time assembly does not have to actually have any design time code in it.&#160; In fact as you’ll see shortly, the two design-time assemblies that our solution has that follow the above naming convention only serve as shims between Visual Studio 2010 and our common WPF and Silverlight design-time assembly that does all the work.</p>
<p><strong>WPF</strong></p>
<p>The below screen shot pictures the WPF run-time custom control folder and contents.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfolderone.png"><img style="display:inline;border-width:0;" title="CiderControlsFolderOne" border="0" alt="CiderControlsFolderOne" src="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfolderone_thumb.png?w=655&#038;h=86" width="655" height="86" /></a></p>
<p>The below screen shot pictures the contents of the \Design\ subfolder. </p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfoldertwo.png"><img style="display:inline;border-width:0;" title="CiderControlsFolderTwo" border="0" alt="CiderControlsFolderTwo" src="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfoldertwo_thumb.png?w=679&#038;h=115" width="679" height="115" /></a> </p>
<p>In the above image, CiderControls.WPF.VisualStudio.Design.dll is the assembly that Visual Studio will discover and load the design-time metadata from.&#160; </p>
<p>CiderControls.Common.VisualStudio.Design.dll is in this folder because it is referenced by CiderControls.WPF.VisualStudio.Design.dll.</p>
<p>CiderControls.WPF.dll is in this folder because it is referenced by the common design-time assembly CiderControls.Common.VisualStudio.Design.dll.</p>
<p><strong>Silverlight</strong></p>
<p>The below screen shot pictures the Silverlight run-time custom control folder and contents.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfolderone.png"><img style="display:inline;border-width:0;" title="CiderControlsSLFolderOne" border="0" alt="CiderControlsSLFolderOne" src="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfolderone_thumb.png?w=663&#038;h=82" width="663" height="82" /></a> </p>
<p>The below screen shot pictures the contents of the \Design\ subfolder.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfoldertwo.png"><img style="display:inline;border-width:0;" title="CiderControlsSLFolderTwo" border="0" alt="CiderControlsSLFolderTwo" src="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfoldertwo_thumb.png?w=700&#038;h=134" width="700" height="134" /></a> </p>
<p>In the above image, CiderControls.Silverlight.VisualStudio.Design.dll is the assembly that Visual Studio will discover and load the design-time metadata from.&#160; </p>
<p>CiderControls.Common.VisualStudio.Design.dll is in this folder because it is referenced by CiderControls.Silverlight.VisualStudio.Design.dll.</p>
<p>CiderControls.Silverlight.VisualStudio.Design.Types.dll is in this folder because it is referenced by CiderControls.Common.VisualStudio.Design.dll and CiderControls.Silverlight.VisualStudio.Design.dll.&#160; </p>
<blockquote>
<p>The above two file references are not a project references but a file or binary references.&#160; When this reference is added, the browse button is used to browse to the CiderControls.Silverlight.dll and the reference added to the file.</p>
</blockquote>
<p>CiderControls.Silverlight.dll is in this folder because it is referenced by CiderControls.Silverlight.VisualStudio.Design.Types.dll.</p>
<p>CiderControls.WPF.dll is in this folder because it is referenced by the common design-time assembly CiderControls.Common.VisualStudio.Design.dll.</p>
<p><strong>Note</strong>: CiderControls.Silverlight.dll and CiderControls.Silverlight.VisualStudio.Design.Types.dll are the only two assemblies that actually reference Silverlight, the remaining assemblies are all WPF assemblies.</p>
<h5>Design Subfolder</h5>
<p>In both of the above series of images, the \Design subfolder is under the \Bin\Debug folder for each custom control assembly.&#160; During development, the best way to populate the \Design subfolder is to set up a Post-build event.&#160; Now your design-time test projects only need to reference the design-time assembly and Visual Studio will automatically load your design-time assembly for you.</p>
<p>For the CiderControls.WPF.VisualStudio.Design.dll project I’m using the following Post-build event command line:</p>
<p>&#160;&#160;&#160; xcopy &quot;$(TargetDir)*.*&quot;&#160;&#160; &quot;$(SolutionDir)\CiderControls.WPF\Bin\Debug\Design&quot; /S /I /Y</p>
<p>For the CiderControls.Silverlight.VisualStudio.Design.dll project I’m using the following Post-build event command line:</p>
<p>&#160;&#160;&#160; xcopy &quot;$(TargetDir)*.*&quot;&#160;&#160; &quot;$(SolutionDir)\CiderControls.Silverlight\Bin\Debug\Design&quot; /S /I /Y</p>
<h4>WPF Metadata Loading</h4>
<p>Visual Studio locating your correctly named design-time assembly is step one.&#160; That assembly must also decorated with the ProvideMetadata attribute: </p>
<p>&#160; <font face="Consolas">[</font><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas">assembly</font></font><font face="Consolas">: </font><font color="#2b91af" face="Consolas"><font color="#2b91af" face="Consolas">ProvideMetadata</font></font><font face="Consolas">(</font><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas">typeof</font></font><font face="Consolas">(</font><font color="#2b91af" face="Consolas"><font color="#2b91af" face="Consolas">RegisterMetadata</font></font><font face="Consolas">))]</font></p>
<p>The ProvideMetadata constructor requires that a type be passed in.&#160; That type must implement the IProvideAttributeTable interface.</p>
<p>IProvideAttributeTable interface has a single read-only property AttributeTable that returns an AttributeTable.</p>
<p>Below is the RegisterMetadata class that is in the CiderControls.WPF.VisualStudio.Design project.</p>
<div class="code">
<pre><span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Registration;
<span style="color:blue;">using </span>CiderControls.WPF.VisualStudio.Design;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Metadata;

[<span style="color:blue;">assembly</span>: <span style="color:#2b91af;">ProvideMetadata</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">RegisterMetadata</span>))]

<span style="color:blue;">namespace </span>CiderControls.WPF.VisualStudio.Design {

  <span style="color:blue;">internal class </span><span style="color:#2b91af;">RegisterMetadata </span>: <span style="color:#2b91af;">IProvideAttributeTable </span>{

    <span style="color:#2b91af;">AttributeTable IProvideAttributeTable</span>.AttributeTable {
      <span style="color:blue;">get </span>{
        <span style="color:#2b91af;">CiderControlsAttributeTableBuilder </span>builder =
            <span style="color:blue;">new </span><span style="color:#2b91af;">CiderControlsAttributeTableBuilder</span>(<span style="color:blue;">new </span><span style="color:#2b91af;">WPFTypeResolver</span>());
        <span style="color:blue;">return </span>builder.CreateTable();
      }
    }
  }
}</pre>
</div>
<p>Within the AttributeTable property we instantiate the CiderControlsAttributeTableBuilder class that derives from AttributeTableBuilder.&#160; AttributeTableBuilder provides the CreateTable method.&#160; </p>
<p>The CiderControlsAttributeTableBuilder is located in the “platform neutral” CiderControls.Common.VisualStudio.Design assembly. </p>
<p>The WPFTypeResolver is passed into the CiderControlsAttributeTableBuilder constructor.&#160; This class allows the “platform neutral” CiderControls.Common.VisualStudio.Design assembly to resolve WPF types in our run-time control assembly by referring to them with platform neutral <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.metadata.typeidentifier(VS.100).aspx" target="_blank">TypeIdentifiers</a>.&#160; The WPFTypeResolver is located in the CiderControls.WPF.VisualStudio.Design project.</p>
<p>The CiderControlsAttributeTableBuilder is the platform neutral class that does all the heavy lifting for creating the required AttributeTable; also know as our metadata.</p>
<p>Below is the WPFTypeResolver class that is in the CiderControls.WPF.VisualStudio.Design project.&#160; The GetPlatformType method takes a platform neutral TypeIdentifier and returns a platform specific type.</p>
<div class="code">
<pre><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Infrastructure;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Registration;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Metadata;

<span style="color:blue;">namespace </span>CiderControls.WPF.VisualStudio.Design {

  <span style="color:blue;">internal class </span><span style="color:#2b91af;">WPFTypeResolver </span>: <span style="color:#2b91af;">RegistrationTypeResolver </span>{

    <span style="color:blue;">public override </span><span style="color:#2b91af;">Type </span>GetPlatformType(<span style="color:#2b91af;">TypeIdentifier </span>id) {
      <span style="color:blue;">switch </span>(id.Name) {

        <span style="color:blue;">case </span><span style="color:#2b91af;">Constants</span>.STR_CIDERCONTROLSFEEDBACK:
          <span style="color:blue;">return typeof</span>(CiderControls.<span style="color:#2b91af;">Feedback</span>);

        <span style="color:blue;">case </span><span style="color:#2b91af;">Constants</span>.STR_CIDERCONTROLSRATING:
          <span style="color:blue;">return typeof</span>(CiderControls.<span style="color:#2b91af;">Rating</span>);
      }

      <span style="color:blue;">throw new </span><span style="color:#2b91af;">ArgumentOutOfRangeException</span>(<span style="color:#a31515;">&quot;id.Name&quot;</span>, id.Name, message...);
    }
  }
}</pre>
</div>
<h4>Silverlight Metadata Loading</h4>
<p>Visual Studio locating your correctly named design-time assembly is step one.&#160; That assembly must also decorated with the ProvideMetadata attribute: </p>
<p>&#160; <font face="Consolas">[</font><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas">assembly</font></font><font face="Consolas">: </font><font color="#2b91af" face="Consolas"><font color="#2b91af" face="Consolas">ProvideMetadata</font></font><font face="Consolas">(</font><font color="#0000ff" face="Consolas"><font color="#0000ff" face="Consolas">typeof</font></font><font face="Consolas">(</font><font color="#2b91af" face="Consolas"><font color="#2b91af" face="Consolas">RegisterMetadata</font></font><font face="Consolas">))]</font></p>
<p>The ProvideMetadata constructor requires that a type be passed in.&#160; That type must implement the IProvideAttributeTable interface.</p>
<p>IProvideAttributeTable interface has a single read-only property AttributeTable that returns an AttributeTable.</p>
<p>Below is the RegisterMetadata class that is in the CiderControls.Silverlight.VisualStudio.Design project.</p>
<div class="code">
<pre><span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Registration;
<span style="color:blue;">using </span>CiderControls.Silverlight.VisualStudio.Design;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Metadata;

[<span style="color:blue;">assembly</span>: <span style="color:#2b91af;">ProvideMetadata</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">RegisterMetadata</span>))]

<span style="color:blue;">namespace </span>CiderControls.Silverlight.VisualStudio.Design {

  <span style="color:blue;">internal class </span><span style="color:#2b91af;">RegisterMetadata </span>: <span style="color:#2b91af;">IProvideAttributeTable </span>{

    <span style="color:#2b91af;">AttributeTable IProvideAttributeTable</span>.AttributeTable {
      <span style="color:blue;">get </span>{
        <span style="color:#2b91af;">CiderControlsAttributeTableBuilder </span>builder =
          <span style="color:blue;">new </span><span style="color:#2b91af;">CiderControlsAttributeTableBuilder</span>(<span style="color:blue;">new </span><span style="color:#2b91af;">SilverlightTypeResolver</span>());
        <span style="color:blue;">return </span>builder.CreateTable();
      }
    }
  }
}</pre>
</div>
<p>Within the AttributeTable property we instantiate the CiderControlsAttributeTableBuilder class that derives from AttributeTableBuilder.&#160; AttributeTableBuilder provides the CreateTable method.&#160; </p>
<p>The CiderControlsAttributeTableBuilder is located in the “platform neutral” CiderControls.Common.VisualStudio.Design assembly. </p>
<p>The SilverlightTypeResolver is passed into the CiderControlsAttributeTableBuilder constructor.&#160; This class allows the “platform neutral” CiderControls.Common.VisualStudio.Design assembly to resolve Silverlight types in our run-time control assembly by referring to them with platform neutral <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.metadata.typeidentifier(VS.100).aspx" target="_blank">TypeIdentifiers</a>.&#160; The SilverlightTypeResolver is located in the CiderControls.Silverlight.VisualStudio.Design project.</p>
<p>The CiderControlsAttributeTableBuilder is the platform neutral class that does all the heavy lifting for creating the required AttributeTable; also know as our metadata.</p>
<p>Below is the SilverlightTypeResolver class that is in the CiderControls.Silverlight.VisualStudio.Design project.&#160; The GetPlatformType method takes a platform neutral TypeIdentifier and returns a platform specific type.</p>
<div class="code">
<pre><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Infrastructure;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Registration;
<span style="color:blue;">using </span>CiderControls.Silverlight.VisualStudio.Design.Types;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Metadata;

<span style="color:blue;">namespace </span>CiderControls.Silverlight.VisualStudio.Design {

  <span style="color:blue;">internal class </span><span style="color:#2b91af;">SilverlightTypeResolver </span>: <span style="color:#2b91af;">RegistrationTypeResolver </span>{

    <span style="color:blue;">public override </span><span style="color:#2b91af;">Type </span>GetPlatformType(<span style="color:#2b91af;">TypeIdentifier </span>id) {
      <span style="color:blue;">switch </span>(id.Name) {

        <span style="color:blue;">case </span><span style="color:#2b91af;">Constants</span>.STR_CIDERCONTROLSFEEDBACK:
          <span style="color:blue;">return </span><span style="color:#2b91af;">SilverlightTypes</span>.FeedbackControlType;

        <span style="color:blue;">case </span><span style="color:#2b91af;">Constants</span>.STR_CIDERCONTROLSRATING:
          <span style="color:blue;">return </span><span style="color:#2b91af;">SilverlightTypes</span>.RatingControlType;

      }

      <span style="color:blue;">throw new </span><span style="color:#2b91af;">ArgumentOutOfRangeException</span>(<span style="color:#a31515;">&quot;id.Name&quot;</span>, id.Name, message...);
    }
  }
}</pre>
</div>
<p>This assembly, CiderControls.Silverlight.VisualStudio.Design is a WPF assembly.&#160; Notice that we are not directly returning a Silverlight type by using the typeof method.&#160; Instead we are returning a type that is located in the CiderControls.Silverlight.VisualStudio.Design.Types assembly and is exposed by static properties in the SivlerlightTypes class below.</p>
<p>The CiderControls.Silverlight.VisualStudio.Design.Types assembly has a project reference to the Sivlerlight controls run-time assembly.</p>
<pre class="code"><span style="color:blue;">using </span>System;

[<span style="color:blue;">assembly</span>:
  System.Runtime.CompilerServices.<span style="color:#2b91af;">InternalsVisibleTo</span>(<span style="color:#a31515;">&quot;CiderControls.Silverlight.VisualStudio.Design&quot;</span>)]

[<span style="color:blue;">assembly</span>:
  System.Runtime.CompilerServices.<span style="color:#2b91af;">InternalsVisibleTo</span>(<span style="color:#a31515;">&quot;CiderControls.Common.VisualStudio.Design&quot;</span>)]

<span style="color:blue;">namespace </span>CiderControls.Silverlight.VisualStudio.Design.Types {

  <span style="color:blue;">internal class </span><span style="color:#2b91af;">SilverlightTypes </span>{

    <span style="color:blue;">public static readonly </span><span style="color:#2b91af;">Type </span>FeedbackControlType = <span style="color:blue;">typeof</span>(CiderControls.<span style="color:#2b91af;">Feedback</span>);
    <span style="color:blue;">public static readonly </span><span style="color:#2b91af;">Type </span>RatingControlType = <span style="color:blue;">typeof</span>(CiderControls.<span style="color:#2b91af;">Rating</span>);
  }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>I’ve made use of the <a href="http://msdn.microsoft.com/en-us/library/0tke9fxk(VS.100).aspx" target="_blank">Friend Assemblies</a> feature that allows all my classes in the solution to be internal.&#160; For VB.NET they will all be scoped as Friend.</p>
<h5>Silverlight Type Resolution </h5>
<p>By now you understand that the CiderControlsAttributeTableBuilder is “platform neutral” and is located in the CiderControls.Common.VisualStudio.Design assembly.</p>
<p>You know that the SiverlightTypeResolver will be pass into the CiderControlsAttributeTableBuilder constructor.&#160; CiderControlsAttributeTableBuilder is the same class that the WPFTypeResolver will be passed into also.</p>
<p>When the CiderControlsAttributeTableBuilder needs to resolve a type it will pass a platform neutral TypeIdentifier to one of the TypeResolvers, they in turn will return a platform specific type.</p>
<p>For Silverlight only, the SiverlightTypeResolver will use the SilverlightTypes class to perform the actual type resolution.</p>
<p>While this seems confusing at first, it is the best way to allow Silverlight types to be resolved in a platform neutral fashion and without polluting a WPF assembly with Silverlight types.</p>
<h4>Metadata Building</h4>
<p>CiderControlsAttributeTableBuilder does the heavy lifting and is responsible for creating the AttributeTable required by Visual Studio.&#160; This code is platform neutral, meaning it returns an AttributeTable for WPF or Silverlight without having to directly reference the run-time assembly controls inside its code.</p>
<p>For the below code, I left the comments in place to make reading a large section of code much easier.&#160; The comments inline explain what is going on.</p>
<p>You’ll notice how the WPFTypeResolver and the SiverlightTypeResolver are used in this code.&#160; The module level variable _registrationTypeResolver holds a reference to the TypeResolver that is used to resolve platform specific types using the platform neutral TypeIdentifier.</p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.ComponentModel;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Controls;
<span style="color:blue;">using </span>CiderControls.Common.VisualStudio.Design.Infrastructure;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Features;
<span style="color:blue;">using </span>Microsoft.Windows.Design.Metadata;
<span style="color:blue;">using </span>Microsoft.Windows.Design.PropertyEditing;
<span style="color:blue;">using </span>Microsoft.Windows.Design;

<span style="color:green;">//
// This should be in AssemblyInfo.cs - declaring here to make it obvious
//

</span>[<span style="color:blue;">assembly</span>:
  System.Runtime.CompilerServices.<span style="color:#2b91af;">InternalsVisibleTo</span>(<span style="color:#a31515;">&quot;CiderControls.WPF.VisualStudio.Design&quot;</span>)]

[<span style="color:blue;">assembly</span>:
  System.Runtime.CompilerServices.<span style="color:#2b91af;">InternalsVisibleTo</span>(<span style="color:#a31515;">&quot;CiderControls.Silverlight.VisualStudio.Design&quot;</span>)]

<span style="color:blue;">namespace </span>CiderControls.Common.VisualStudio.Design.Registration {

  <span style="color:green;">//TODO  5 - CiderControlsAttributeTableBuilder

  </span><span style="color:gray;">/// &lt;summary&gt;
  /// </span><span style="color:green;">Platform neutral class that builds platform specific metadata
  </span><span style="color:gray;">/// &lt;/summary&gt;
  </span><span style="color:blue;">internal class </span><span style="color:#2b91af;">CiderControlsAttributeTableBuilder </span>: <span style="color:#2b91af;">AttributeTableBuilder </span>{

    <span style="color:green;">// allows for Platform specific Types to be used without directly referencing Silverlight
    </span><span style="color:blue;">private </span><span style="color:#2b91af;">RegistrationTypeResolver </span>_registrationTypeResolver;

    <span style="color:green;">//TODO  6 - registrationTypeResolver resolves the platform specific Types in the platform neutral
    //          metadata builder
    </span><span style="color:blue;">public </span>CiderControlsAttributeTableBuilder(<span style="color:#2b91af;">RegistrationTypeResolver </span>registrationTypeResolver) {
      _registrationTypeResolver = registrationTypeResolver;

      AddFeedbackControlAttributes();
      AddRatingControlAttributes();
    }

    <span style="color:gray;">/// &lt;summary&gt;
    /// </span><span style="color:green;">Builds Feedback control metedata
    </span><span style="color:gray;">/// &lt;/summary&gt;
    </span><span style="color:blue;">private void </span>AddFeedbackControlAttributes() {

      <span style="color:green;">//TODO  7 - Resolve the Platform specific Feedback control from the platform neutral
      //          TypeIdentifier
      </span><span style="color:#2b91af;">Type </span>feebackType = _registrationTypeResolver.GetPlatformType(<span style="color:#2b91af;">MyPlatformTypes</span>.<span style="color:#2b91af;">Feedback</span>.TypeId);

      <span style="color:green;">//TODO  9 - Using the above feedbackType, create platform specific metadata for the Feedback
      //          control the below code adds features, catetory editor, inline editor, type converter
      //          and assigns a Category to each Feedback control property

      </span>AddTypeAttributes(feebackType,
          <span style="color:blue;">new </span><span style="color:#2b91af;">FeatureAttribute</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">FeedbackControlInitializer</span>)),
          <span style="color:blue;">new </span><span style="color:#2b91af;">FeatureAttribute</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">FeedbackControlContextMenuProvider</span>)),
          <span style="color:blue;">new </span><span style="color:#2b91af;">FeatureAttribute</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">FeedbackControlAdornerProvider</span>))
          );

      AddCategoryEditor(feebackType,
          <span style="color:blue;">typeof</span>(<span style="color:#2b91af;">FeedbackControlCategoryEditor</span>));

      AddMemberAttributes(feebackType,
          <span style="color:#2b91af;">Constants</span>.STR_CORNERRADIUS,
          <span style="color:blue;">new </span><span style="color:#2b91af;">CategoryAttribute</span>(<span style="color:#2b91af;">Constants</span>.STR_COMMON));

      <span style="color:green;">// since the below Header property is of type object, it requires this
      // StringConverter to enable editing of simple string values in the properties window.
      </span>AddMemberAttributes(feebackType,
          <span style="color:#2b91af;">Constants</span>.STR_HEADER,
          <span style="color:blue;">new </span><span style="color:#2b91af;">CategoryAttribute</span>(<span style="color:#2b91af;">Constants</span>.STR_CUSTOM),
          <span style="color:blue;">new </span><span style="color:#2b91af;">TypeConverterAttribute</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">StringConverter</span>)));

      AddMemberAttributes(feebackType,
          <span style="color:#2b91af;">Constants</span>.STR_VALUE,
          <span style="color:blue;">new </span><span style="color:#2b91af;">CategoryAttribute</span>(<span style="color:#2b91af;">Constants</span>.STR_CUSTOM),
          <span style="color:#2b91af;">PropertyValueEditor</span>.CreateEditorAttribute(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">RatingSelectorInlineEditor</span>)));

      AddMemberAttributes(feebackType,
          <span style="color:#2b91af;">Constants</span>.STR_COMMENT,
          <span style="color:blue;">new </span><span style="color:#2b91af;">CategoryAttribute</span>(<span style="color:#2b91af;">Constants</span>.STR_CUSTOM));

      AddMemberAttributes(feebackType,
          <span style="color:#2b91af;">Constants</span>.STR_COMMENTHEADING,
          <span style="color:blue;">new </span><span style="color:#2b91af;">CategoryAttribute</span>(<span style="color:#2b91af;">Constants</span>.STR_CUSTOM));

    }

    <span style="color:gray;">/// &lt;summary&gt;
    /// </span><span style="color:green;">Builds Rating control metedata
    </span><span style="color:gray;">/// &lt;/summary&gt;
    </span><span style="color:blue;">private void </span>AddRatingControlAttributes() {

      <span style="color:green;">//TODO  7.1 - Resolve the Platform specific Rating control from the platform neutral
      //            TypeIdentifier
      </span><span style="color:#2b91af;">Type </span>ratingType = _registrationTypeResolver.GetPlatformType(<span style="color:#2b91af;">MyPlatformTypes</span>.<span style="color:#2b91af;">Rating</span>.TypeId);

      <span style="color:green;">//TODO  9.1 - Using the above ratingType, create platform specific metadata for the Rating
      //            control the below code keeps the Rating control from appearing in the
      //            Choose Items dialog after the CiderControls.WPF or CiderControls.Siverlight
      //            assembly is added.
      //
      // this is only done for illustration, there is no actual reason to keep the Rating control
      // out of the Choose Items dialog.
      </span>AddTypeAttributes(ratingType,
          <span style="color:blue;">new </span><span style="color:#2b91af;">ToolboxBrowsableAttribute</span>(<span style="color:blue;">false</span>)
          );
    }

    <span style="color:blue;">private void </span>AddTypeAttributes(<span style="color:#2b91af;">Type </span>type, <span style="color:blue;">params </span><span style="color:#2b91af;">Attribute</span>[] attribs) {
      <span style="color:blue;">base</span>.AddCallback(type, builder =&gt; builder.AddCustomAttributes(attribs));
    }

    <span style="color:blue;">private void </span>AddCategoryEditor(<span style="color:#2b91af;">Type </span>type, <span style="color:#2b91af;">Type </span>editorType) {
      <span style="color:blue;">base</span>.AddCallback(type, builder =&gt;
         builder.AddCustomAttributes(<span style="color:#2b91af;">CategoryEditor</span>.CreateEditorAttribute(editorType)));
    }

    <span style="color:blue;">private void </span>AddMemberAttributes(<span style="color:#2b91af;">Type </span>type, <span style="color:blue;">string </span>memberName, <span style="color:blue;">params </span><span style="color:#2b91af;">Attribute</span>[] attribs) {
      <span style="color:blue;">base</span>.AddCallback(type, builder =&gt; builder.AddCustomAttributes(memberName, attribs));
    }
  }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The last three methods are helper methods that make the metadata code cleaner and easier to read.</p>
<p>In the next Part II of this article, I’ll tie the above attributes to each of the design-time features.</p>
<h4>Downloads</h4>
<p><a href="http://code.msdn.microsoft.com/DesignerExtensbility/Release/ProjectReleases.aspx?ReleaseId=3583" target="_blank">Source Code Download</a></p>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/ExtensibilityPresentationSlides/ControlDesigntimesForSilverlightAndWPF.zip" target="_blank">PowerPoint Slides from the Development Tools Ecosystem Summit Presentation</a></p>
<h4>Online Documentation Status</h4>
<p>Almost all of MSDN and most examples you’ll see on the Internet use the interfaces from Visual Studio 2008.&#160; When you see IRegisterMetadata used in an example, you know you’re looking at old code.&#160; Overtime this will change, new examples will be posted and MSDN updated.</p>
<p>Remember IRegisterMetadata has been replaced with IProvideAttributeTable in Visual Studio 2010.&#160; Most of old the code and the substance of the example or documentation you are viewing is probably correct and good to learn from.&#160; You just need to be aware that you are looking at older code and that example won’t compile under Visual Studio 2010.</p>
<h4>More Information Links</h4>
<p><a href="http://msdn.microsoft.com/en-us/library/bb546938(VS.100).aspx" target="_blank">MSDN: WPF Designer Extensibility</a>&#160; (This is the best extensibility reference.)</p>
<p><a href="http://code.msdn.microsoft.com/DesignerExtensbility" target="_blank">WPF and Silverlight Designer Extensibility Samples</a></p>
<p><a href="http://blog.ningzhang.org/2009/10/silverlight-design-time-toolkit-october.html" target="_blank">Ning Zhang&#8217;s Blog: Silverlight Design Time: Toolkit October 2009 Release Update</a></p>
<p><a href="http://blog.ningzhang.org/2009/03/how-to-write-silverlight-design-time.html" target="_blank">How to Write Silverlight Design Time for All Designers: Visual Studio 2008, Blend 2; Blend 3, and Visual Studio 2010</a></p>
<h4>Close</h4>
<p>Hope each of you have a wonderful Thanksgiving.&#160; </p>
<p>I’m going out to sea again to write code for a week.&#160; You can follow my cruise Tweets @kdawg02.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in C#, Cider Designer, CodeProject, Extensibility, Extensibility Series, Silverlight, Silverlight Controls, VB.NET, Visual Studio 2010, WPF Controls, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1187&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/breadcrumbtrail_thumb.png" medium="image">
			<media:title type="html">BreadcrumbTrail</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrol_thumb.png" medium="image">
			<media:title type="html">FeedbackControl</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/feedbackcontrolclassdiagram_thumb.png" medium="image">
			<media:title type="html">FeedbackControlClassDiagram</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/menuaction_thumb.png" medium="image">
			<media:title type="html">MenuAction</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/adorner_thumb.png" medium="image">
			<media:title type="html">Adorner</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/valueeditor_thumb.png" medium="image">
			<media:title type="html">ValueEditor</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/categoryview_thumb.png" medium="image">
			<media:title type="html">CategoryView</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfolderone_thumb.png" medium="image">
			<media:title type="html">CiderControlsFolderOne</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsfoldertwo_thumb.png" medium="image">
			<media:title type="html">CiderControlsFolderTwo</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfolderone_thumb.png" medium="image">
			<media:title type="html">CiderControlsSLFolderOne</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/cidercontrolsslfoldertwo_thumb.png" medium="image">
			<media:title type="html">CiderControlsSLFolderTwo</media:title>
		</media:content>
	</item>
		<item>
		<title>Silverlight 3 &amp; 4 Library Sharing with .NET 4.0 Library or WPF</title>
		<link>http://karlshifflett.wordpress.com/2009/11/19/silverlight-3-4-library-sharing-with-net-4-0-library-or-wpf/</link>
		<comments>http://karlshifflett.wordpress.com/2009/11/19/silverlight-3-4-library-sharing-with-net-4-0-library-or-wpf/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 13:15:16 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/11/19/silverlight-3-4-library-sharing-with-net-4-0-library-or-wpf/</guid>
		<description><![CDATA[ 
As if you need “another” reason to start running Visual Studio 2010 Beta2, here is another for all the cross platform .NET Line of Business application developers.
Silverlight 3 &#38; 4 Library assemblies can be referenced in .NET 4.0 applications and used.&#160; 
The above WPF application has a file reference also known as a binary [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1164&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://karlshifflett.files.wordpress.com/2009/11/slwpfapplication.png"><img style="display:inline;border-width:0;" title="slwpfapplication" border="0" alt="slwpfapplication" src="http://karlshifflett.files.wordpress.com/2009/11/slwpfapplication_thumb.png?w=433&#038;h=224" width="433" height="224" /></a> </p>
<p>As if you need “another” reason to start running Visual Studio 2010 Beta2, here is another for all the cross platform .NET Line of Business application developers.</p>
<p>Silverlight 3 &amp; 4 Library assemblies can be referenced in .NET 4.0 applications and used.&#160; </p>
<p>The above WPF application has a file reference also known as a binary reference (as opposed to a project reference) to the BusinessEntities.Silverlight.dll and has instantiated the Customer class and used it for the DataContext for the above MainWindow.</p>
<h4>How To Do It</h4>
<p>The steps are simple, but you need to follow the workflow to avoid issues.</p>
<p>1.&#160; Your Silverlight <u>Library</u> can’t have any “Silverlight specific” code in it.&#160; I have been able to share my own framework code (Ocean) and business entities without any issues.&#160; </p>
<p>Now that Silverlight 4 has shipped and IDataErrorInfo has been added this enables entity sharing between Silverlight and WPF much easier since you no longer have to implement this interface youself just to get code compatibility with your business objects. </p>
<p>2.&#160; Set up a file reference (as opposed to a project reference) between the .NET 4.0 project and your Silverlight 3 or 4 class library .dll.&#160; In the add reference dialog, use the Browse button to locate the target .dll.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/slwpfsolution.png"><img style="display:inline;border-width:0;" title="slwpfsolution" border="0" alt="slwpfsolution" src="http://karlshifflett.files.wordpress.com/2009/11/slwpfsolution_thumb.png?w=317&#038;h=628" width="317" height="628" /></a></p>
<p>3.&#160; If you have the Silverlight 3 or 4 library in the same solution as the consuming .NET 4.0 project(s) it is important that you establish the correct project dependencies and build order.&#160; By default, Visual Studio will not alter your project build order when a file reference is make.</p>
<p>In our case, we need the project build order to look like the below image.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/projectdependencies.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="ProjectDependencies" border="0" alt="ProjectDependencies" src="http://karlshifflett.files.wordpress.com/2009/11/projectdependencies_thumb.png?w=483&#038;h=443" width="483" height="443" /></a> </p>
<p>To establish the above build order, switch to the Dependencies tab, select the other solution projects that depend on the Silverlight 3 or 4 class library and check the Silverlight 3 or 4 library as pictured below.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/buildorder.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="BuildOrder" border="0" alt="BuildOrder" src="http://karlshifflett.files.wordpress.com/2009/11/buildorder_thumb.png?w=480&#038;h=453" width="480" height="453" /></a> </p>
<h4>A Few Thoughts</h4>
<p>If you have never used file reference projects in your solution a few things in the user experience are slightly different.&#160; </p>
<p><strong>IntelliSense</strong></p>
<p>If you edit the Silverlight 3 or 4 class library, don’t expect those changes to be picked up by the .NET 4.0 project(s) until after you build.&#160; This means, if you added a property or method in the code editor, IntelliSense in the .NET 4.0 project won’t “list it” until you build the <u>solution</u>.</p>
<p><strong>Build Order</strong></p>
<p>Its easy to overlook manually setting the project dependencies to ensure the correct build order since for all other projects you have ever created Visual Studio did this for you.</p>
<p>Also, don’t overlook this step after adding a new project to an existing solution that you’ve already set the build order on.</p>
<p><strong>Clean Solution</strong></p>
<p>If you have the Silverlight 3 or 4 class library in the solution and you clean the solution, the library assembly .dll will be removed from output folder.&#160; This will cause Visual Studio to add some errors to your Error List since it can no long find the referenced assembly.&#160; After building the solution, these errors will be removed from the Error List.</p>
<p>So… if you clean your solution and send it to someone like on a blog post, developers that open your solution will see these errors.&#160; Again, build and all is well.</p>
<h4><strong>Service References</strong></h4>
<p>Now that you can put your business entities in a Silverlight 3 or 4 class library and your .NET 4.0 service, business and data layers can consume those entities, take full advantage of service reference dialog Advanced settings.&#160; Advanced button is located in the lower left corner of the Add Service Reference dialog.</p>
<p>I have had issues with the Add Service Reference feature when trying to get it to reuse my existing types.&#160; So I always elect to help the wizard and specifically select the assemblies that contain my business entities as I’ve done in the below image.</p>
<p>Note:&#160; The project download does not have a service reference, the below image is from another project.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/11/servicereference.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="ServiceReference" border="0" alt="ServiceReference" src="http://karlshifflett.files.wordpress.com/2009/11/servicereference_thumb.png?w=669&#038;h=622" width="669" height="622" /></a> </p>
<p>I love this feature because it allows me to use my business entities that have code in them in all the layers of my application without any duplication of code.&#160; This also easily enables entity sharing between Silverlight 3 OR 4 and WPF.</p>
<h4>Download</h4>
<p>The project source code can be downloaded from my SkyDrive.</p>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/WPFSilverlightLibrarySharing/WPFSilverlightLibrarySharing.zip" target="_blank">Source Code (97KB)</a></p>
<h4>Close</h4>
<p>Hope you like the new developer productivity capabilities of Visual Studio 2010.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1164&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/11/19/silverlight-3-4-library-sharing-with-net-4-0-library-or-wpf/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/slwpfapplication_thumb.png" medium="image">
			<media:title type="html">slwpfapplication</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/slwpfsolution_thumb.png" medium="image">
			<media:title type="html">slwpfsolution</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/projectdependencies_thumb.png" medium="image">
			<media:title type="html">ProjectDependencies</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/buildorder_thumb.png" medium="image">
			<media:title type="html">BuildOrder</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/11/servicereference_thumb.png" medium="image">
			<media:title type="html">ServiceReference</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 2010 &#8211; Visual Basic New Feature &#8211; NonSerialized Events</title>
		<link>http://karlshifflett.wordpress.com/2009/11/17/visual-studio-2010-visual-basic-new-feature-nonserialized-events/</link>
		<comments>http://karlshifflett.wordpress.com/2009/11/17/visual-studio-2010-visual-basic-new-feature-nonserialized-events/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 14:54:27 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/11/17/visual-studio-2010-visual-basic-new-feature-nonserialized-events/</guid>
		<description><![CDATA[A long time feature request has been added to Visual Basic 10 that ships with Visual Studio 2010; decorating an Event as NonSerialized.
In prior versions of Visual Basic developers had to implement a Custom Event or another workaround when their types needed to expose an Event and they had to be Serializable.&#160; C# had this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1153&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A long time feature request has been added to Visual Basic 10 that ships with Visual Studio 2010; decorating an Event as NonSerialized.</p>
<p>In prior versions of Visual Basic developers had to implement a Custom Event or another workaround when their types needed to expose an Event and they had to be Serializable.&#160; C# had this capability, now Visual Basic does too!</p>
<p>A very common scenario is a class that implements INotifyPropertyChanged and must also be Serializable.&#160; </p>
<p>Visual Basic developers can now decorate the Event with the NonSerialized attribute.&#160; The compiler does the rest for you.</p>
<div class="code">
<pre><span style="color:blue;">Imports </span>System.ComponentModel

&lt;<span style="color:#2b91af;">Serializable</span>()&gt;
<span style="color:blue;">Public Class </span><span style="color:#2b91af;">Customer
    </span><span style="color:blue;">Implements </span><span style="color:#2b91af;">INotifyPropertyChanged

</span><span style="color:blue;">#Region </span><span style="color:#a31515;">&quot; INotifyPropertyChanged Serializable &quot;

    </span><span style="color:green;">'New VB 10 feature!
    </span>&lt;<span style="color:#2b91af;">NonSerialized</span>()&gt;
    <span style="color:blue;">Public Event </span>PropertyChanged(
                  <span style="color:blue;">ByVal </span>sender <span style="color:blue;">As Object</span>,
                  <span style="color:blue;">ByVal </span>e <span style="color:blue;">As </span>System.ComponentModel.<span style="color:#2b91af;">PropertyChangedEventArgs</span>) _
                  <span style="color:blue;">Implements </span>System.ComponentModel.<span style="color:#2b91af;">INotifyPropertyChanged</span>.PropertyChanged

    <span style="color:blue;">Protected Sub </span>OnPropertyChanged(<span style="color:blue;">ByVal </span>strPropertyName <span style="color:blue;">As String</span>)
        <span style="color:blue;">If Me</span>.PropertyChangedEvent <span style="color:blue;">IsNot Nothing Then
            RaiseEvent </span>PropertyChanged(<span style="color:blue;">Me</span>, <span style="color:blue;">New </span><span style="color:#2b91af;">PropertyChangedEventArgs</span>(strPropertyName))
        <span style="color:blue;">End If
    End Sub

#End Region

End Class
</span></pre>
</div>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, Tips, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1153&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/11/17/visual-studio-2010-visual-basic-new-feature-nonserialized-events/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>T4 Preprocessed Text Templates in Visual Studio 2010</title>
		<link>http://karlshifflett.wordpress.com/2009/10/30/t4-preprocessed-text-templates-in-visual-studio-2010/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/30/t4-preprocessed-text-templates-in-visual-studio-2010/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 16:23:23 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Code Generation]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[T4]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/30/t4-preprocessed-text-templates-in-visual-studio-2010/</guid>
		<description><![CDATA[The best kept secret in Redmond, WA are the new T4 Preprocess Text Templates that shipped in Visual Studio 2010 Beta1 and Beta2.&#160; In just a few minutes you’ll be in the know and using them.
Background – Condensed 
T4 = text template transformation toolkit
T4 templates have been available since Visual Studio 2005 and are part [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1149&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The best kept secret in Redmond, WA are the new T4 Preprocess Text Templates that shipped in Visual Studio 2010 Beta1 and Beta2.&#160; In just a few minutes you’ll be in the know and using them.</p>
<h4>Background – Condensed </h4>
<p><strong>T4</strong> = text template transformation toolkit</p>
<p>T4 templates have been available since Visual Studio 2005 and are part of DSL (Domain Specific Languages) documentation.</p>
<p>In Visual Studio 2010 the templates are MUCH easier to use because they are preprocessed.&#160; When you save your T4 template, it is compiled.&#160; The T4 template is now “processed” at compile time.&#160; This was not the case in previous releases. </p>
<p>Your compiled template is just another type in an assembly that you can now instantiate and call its single method, TransformText.&#160; The only run-time requirement to use T4 templates is the .NET 2.0 Framework. </p>
<h4>Prerequisites</h4>
<ul>
<li>Visual Studio 2010 </li>
<li>T4 Editor Plug In&#160;
<ul>
<li>Visual Studio 2010 does not provide any editing assistance when editing T4 templates (.tt files).&#160; You can search the Internet for T4 Editor and you’ll find some information and products. </li>
<li>I’m currently using the Tangible T4 Editor (free) that you can get on the Visual Studio Gallery here:&#160;
<ul>
<li><a href="http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23" target="_blank">http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23</a> </li>
<li>The editor is an Alpha version, has a few limitations but I was able to author the below template in a few minutes. </li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Our Scenario</h4>
<p>We have been tasked with creating some code that we can pass data fields to and that code will create a VB.NET property.&#160; This code will be part of a larger program that is fed information and creates class files.</p>
<p>Before T4 Preprocessed templates we had several options available to us.&#160; Write code to spit out the required property, buy a 3rd party product, use CodeDom, etc.</p>
<p>Since we just installed Visual Studio 2010 Beta2, we are going for the productive, inexpensive, simple and out of the box solution, T4 Preprocessed Text Template.</p>
<h4>Our Test Bench</h4>
<p>This simple application simulates the data harness that will ultimately feed our T4 template and consume its output.&#160; Set a few data fields and press Generate Code.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/demoapplicaiton.png"><img style="display:inline;border-width:0;" title="demoApplicaiton" border="0" alt="demoApplicaiton" src="http://karlshifflett.files.wordpress.com/2009/10/demoapplicaiton_thumb.png?w=510&#038;h=572" width="510" height="572" /></a></p>
<h4>Code Generation – It’s all about the data</h4>
<p>Code generation requires metadata to drive the output.&#160; With the new T4 templates, getting metadata into your T4 template is a simple matter of a partial class.&#160; The members in the partial class are available at design time and run-time.&#160; I know this seems so simple, but T4 did not always work this way.&#160; Now you have full design time strong typing and instant compile time verification of your template and code.</p>
<p>To keep this example as simple as possible, I’ve exposed the metadata directly as properties and passed values for them in the constructor of our Partial Class PropertyTemplate.&#160; For simple scenarios this totally fine.&#160; For a larger or multi-language code generation applications, a better solution is to expose the metadata through an Interface.&#160; The Interface type can contain metadata and helper methods that can be used in your T4 template.</p>
<p><a href="http://msmvps.com/blogs/kathleen/" target="_blank">Kathleen Dollard</a> and I have spoken a good bit about this and think using Interfaces for metadata and helper methods makes the most sense.&#160; I’m sure Kathleen will write more on this subject and I know I will.</p>
<p>In the below T4TemplateLibrary project you can see how I’ve set up the project.&#160; I had to turn on “Show All Files” to see the hidden file, “PropertyTemplate.vb” below the “PropertyTemplate.tt” file. </p>
<blockquote><p>Open the hidden “PropertyTemplate.vb” file up and you will see the type of code you and I used to have to write to generate code.&#160; Now T4 does it for us!</p>
</blockquote>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/t4project.png"><img style="display:inline;border-width:0;" title="T4Project" border="0" alt="T4Project" src="http://karlshifflett.files.wordpress.com/2009/10/t4project_thumb.png?w=244&#038;h=211" width="244" height="211" /></a></p>
<p>The below partial class is overly simple and exposes metadata that will be consumed by the T4 template.</p>
<div class="code">
<pre><span style="color:blue;">Namespace My</span>.Templates

  <span style="color:blue;">Partial Public Class </span><span style="color:#2b91af;">PropertyTemplate

    </span><span style="color:blue;">Public Property </span>PropertyName <span style="color:blue;">As String </span>= <span style="color:blue;">String</span>.Empty
    <span style="color:blue;">Public Property </span>BackingField <span style="color:blue;">As String </span>= <span style="color:blue;">String</span>.Empty
    <span style="color:blue;">Public Property </span>TypeName <span style="color:blue;">As String </span>= <span style="color:blue;">String</span>.Empty
    <span style="color:blue;">Public Property </span>IsShared <span style="color:blue;">As Boolean </span>= <span style="color:blue;">False
    Public Property </span>RaisePropertyChangedMethodName <span style="color:blue;">As String </span>= <span style="color:blue;">String</span>.Empty
    <span style="color:blue;">Public Property </span>IsReadOnly <span style="color:blue;">As Boolean </span>= <span style="color:blue;">False
    Public Property </span>Scope <span style="color:blue;">As String </span>= <span style="color:blue;">String</span>.Empty
    <span style="color:blue;">Public Property </span>IsSetterPrivate <span style="color:blue;">As Boolean </span>= <span style="color:blue;">False

    Public Sub New</span>(<span style="color:blue;">ByVal </span>strScope <span style="color:blue;">As String</span>, <span style="color:blue;">ByVal </span>bolIsShared <span style="color:blue;">As Boolean</span>,
                   <span style="color:blue;">ByVal </span>bolIsReadOnly <span style="color:blue;">As Boolean</span>, <span style="color:blue;">ByVal </span>bolIsSetterPrivate <span style="color:blue;">As Boolean</span>,
                   <span style="color:blue;">ByVal </span>strPropertyName <span style="color:blue;">As String</span>, <span style="color:blue;">ByVal </span>strBackingField <span style="color:blue;">As String</span>,
                   <span style="color:blue;">ByVal </span>strTypeName <span style="color:blue;">As String</span>, <span style="color:blue;">ByVal </span>strRaisePropertyChangedMethodName <span style="color:blue;">As String</span>)
      <span style="color:blue;">Me</span>.Scope = strScope
      <span style="color:blue;">Me</span>.IsShared = bolIsShared
      <span style="color:blue;">Me</span>.IsReadOnly = bolIsReadOnly
      <span style="color:blue;">Me</span>.IsSetterPrivate = bolIsSetterPrivate
      <span style="color:blue;">Me</span>.PropertyName = strPropertyName
      <span style="color:blue;">Me</span>.BackingField = strBackingField
      <span style="color:blue;">Me</span>.TypeName = strTypeName
      <span style="color:blue;">Me</span>.RaisePropertyChangedMethodName = strRaisePropertyChangedMethodName
    <span style="color:blue;">End Sub

  End Class

End Namespace
</span></pre>
</div>
<h4>T4 Template</h4>
<p>To add a T4 template to your project, select Add New Item, then type “preprocessed” in the search box.&#160; Select the Preprocess Text Template.</p>
<p>If you used classic ASP, then T4 template editing is a skill you already have.&#160; In classic ASP we used &lt;% and &lt;%=.&#160; In T4 we use &lt;# and &lt;#=.&#160; The reason for this change is so that T4 can be used to generate classic ASP and ASP.NET code.&#160; If you didn’t have the joy of shipping classic ASP web sites, no worries.&#160; 15 minutes of trail and error and you’ll be fully qualified.</p>
<p>The below image shows the free Tangible T4 Editor Plug-In IntelliSense in action.&#160; It provides IntelliSense for T4 directives and template specific constructs like &lt;#.&#160; It also colorizes the template code.&#160; Colorizing makes editing the template much easier too.&#160; One current limitation is that its IntelliSense engine does list member properties defined in the partial class for the template.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/t4intellisense.png"><img style="display:inline;border-width:0;" title="T4IntelliSense" border="0" alt="T4IntelliSense" src="http://karlshifflett.files.wordpress.com/2009/10/t4intellisense_thumb.png?w=553&#038;h=263" width="553" height="263" /></a>&#160;</p>
<p>The below code block is the T4 template.&#160; It has a language directive at the top followed by static text and code blocks.</p>
<div class="code">
<pre style="overflow:auto;"><span style="color:black;">&lt;#@ </span><span style="color:brown;">template </span><span style="color:red;">language</span><span style="color:black;">=&quot;</span><span style="color:blue;">VB</span><span style="color:black;">&quot; #&gt;

&lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.Scope #&gt;&lt;#= </span><span style="color:blue;">IIF</span><span style="color:black;">(</span><span style="color:blue;">Me</span><span style="color:black;">.IsShared, </span><span style="color:maroon;">&quot; Shared&quot;</span><span style="color:black;">,</span><span style="color:maroon;">&quot;&quot;</span><span style="color:black;">) #&gt;&lt;#= </span><span style="color:blue;">IIF</span><span style="color:black;">(</span><span style="color:blue;">Me</span><span style="color:black;">.IsReadOnly, </span><span style="color:maroon;">&quot; ReadOnly&quot;</span><span style="color:black;">, </span><span style="color:maroon;">&quot;&quot;</span><span style="color:black;">) #&gt; Property &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.PropertyName #&gt; As &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.TypeName #&gt;
    Get
        Return &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.BackingField #&gt;
    End Get
&lt;# </span><span style="color:blue;">If Not Me</span><span style="color:black;">.IsReadOnly </span><span style="color:blue;">Then </span><span style="color:black;">#&gt;
    &lt;#= </span><span style="color:blue;">IIF</span><span style="color:black;">(</span><span style="color:blue;">Me</span><span style="color:black;">.IsSetterPrivate, </span><span style="color:maroon;">&quot; Private &quot;</span><span style="color:black;">,</span><span style="color:maroon;">&quot;&quot;</span><span style="color:black;">) #&gt;Set(ByVal value As &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.TypeName #&gt;)
&lt;# </span><span style="color:blue;">If String</span><span style="color:black;">.IsNullOrEmpty(</span><span style="color:blue;">Me</span><span style="color:black;">.RaisePropertyChangedMethodName) </span><span style="color:blue;">Then </span><span style="color:black;">#&gt;
        &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.BackingField #&gt; = value
&lt;# </span><span style="color:blue;">Else </span><span style="color:black;">#&gt;
        &lt;#= </span><span style="color:blue;">Me</span><span style="color:black;">.BackingField #&gt; = value
        &lt;#= </span><span style="color:blue;">String</span><span style="color:black;">.Format(</span><span style="color:maroon;">&quot;{0}(&quot;&quot;{1}&quot;&quot;)&quot;</span><span style="color:black;">, </span><span style="color:blue;">Me</span><span style="color:black;">.RaisePropertyChangedMethodName, </span><span style="color:blue;">Me</span><span style="color:black;">.PropertyName) #&gt;
&lt;# </span><span style="color:blue;">End If </span><span style="color:black;">#&gt;
    End Set
&lt;# </span><span style="color:blue;">End If </span><span style="color:black;">#&gt;
End Property</span></pre>
</div>
<p>&lt;#=&#160; is the same as the ASP Response.Write.&#160; It writes the result of the expression into the template.&#160; For example, if the Scope is Public, &lt;#= Me.Scope #&gt; would yield Public when the template is transformed at run-time.</p>
<p>&lt;# is the beginning of a code block.&#160; Notice how the IsReadOnly property is tested.&#160; Basic on the result, an entire block of code can either run or be by-passed.&#160; This feature is so cool when you bring loops from LINQ queries into the picture.</p>
<p>One thing you’ll notice is that all the code blocks are left justified.&#160; Yes, this makes reading the template a little harder.&#160; However, if you don’t do this, the resulting code will be indented the same amount as the code block indentation.</p>
<p>So what I do when editing my templates is to indent everything to make it easier to edit the template.&#160; When I”m done, I go back and move the code to the left.</p>
<h4>Run-Time Rendering of T4 Templates</h4>
<div class="code">
<pre class="code"><span style="color:blue;">Dim </span>t <span style="color:blue;">As New </span><span style="color:#2b91af;">PropertyTemplate</span>(
    <span style="color:blue;">Me</span>.cboScope.SelectedItem.ToString,
    <span style="color:blue;">Me</span>.chkIsShared.IsChecked.Value,
    <span style="color:blue;">Me</span>.chkIsReadOnly.IsChecked.Value,
    <span style="color:blue;">Me</span>.chkIsSetterPrivate.IsChecked.Value,
    <span style="color:blue;">Me</span>.txtPropertyName.Text,
    <span style="color:blue;">Me</span>.txtBackingField.Text,
    <span style="color:blue;">Me</span>.cboTypeName.SelectedItem.ToString,
    <span style="color:blue;">Me</span>.cboRaisePropertyChangedMethodName.SelectedItem.ToString)

<span style="color:green;">'How cool is this?  Instantiate, call a single method, get the code!
</span><span style="color:blue;">Dim </span>strResult <span style="color:blue;">As String </span>= t.TransformText</pre>
</div>
<p>Instantiate the template, call the TransformText method.&#160; Not very sexy, but powerful!</p>
<h4>Download</h4>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/T4%20Preprocessed%20Text%20Templates/GetYourT4On.zip" target="_blank">Get Your T4 On Demo Application (33KB)</a></p>
<p><strong>Alternate Download Site </strong></p>
<p>Some corporate firewalls do not allow access to Windows Live Sky Drive. You can download the installer here. Remember to rename the file from .doc to .zip. This is a requirement of WordPress.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/getyourt4on-zip.doc" target="_blank">Get Your T4 On Demo Application (33KB)</a></p>
<h4>Links</h4>
<p><a href="http://blogs.msdn.com/garethj/" target="_blank">Gareth Jones blog</a>&#160; Gareth works on the DSL Team at Microsoft and works with the Microsoft T4 product.</p>
<p><a href="http://msmvps.com/blogs/kathleen/" target="_blank">Kathleen Dollard’s blog</a> Kathleen has been doing code generation for a very long time and is an industry expert in this space.</p>
<p><a href="http://blogs.appventure.com/Kathleen/2009/09/04/WhyIsAPreprocessedTemplateTheCoolestThingSinceSlicedBread.aspx" target="_blank">Kathleen Dollard’s</a> work blog post on why T4 Templates are the best thing since sliced bread.</p>
<p><a href="http://www.olegsych.com/2009/09/t4-preprocessed-text-templates/" target="_blank">Oleg Sych</a> very nice blog post on T4 Preprocessed Text Templates</p>
<p><a href="http://www.clariusconsulting.net/blogs/pga/archive/2009/07/15/160836.aspx" target="_blank">Pablo Galiano</a> T4 Preprocessing Part 1</p>
<p><a href="http://www.clariusconsulting.net/blogs/pga/archive/2009/07/15/160853.aspx" target="_blank">Pablo Galiano</a> T4 Preprocessing Part 2</p>
<h4>Close</h4>
<p>There is a fair amount of information on Visual Studio 2005/2008 T4 templates.&#160; When reading these blog posts, magazine articles and MSDN Documentation, keep in mind that the new T4 templates do not have wide spread documentation yet.&#160; Most of what you will find is applicable to editing of the templates and directives used in the templates.&#160; Beyond that, just filter the information and you’ll stay on course.</p>
<p>Visual Studio 2010 T4 Preprocessed Text Templates are a great tool for your toolbox.&#160; Hope to see you use the best kept secret in Redmond.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Code Generation, CodeProject, T4, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1149&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/30/t4-preprocessed-text-templates-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/demoapplicaiton_thumb.png" medium="image">
			<media:title type="html">demoApplicaiton</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/t4project_thumb.png" medium="image">
			<media:title type="html">T4Project</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/t4intellisense_thumb.png" medium="image">
			<media:title type="html">T4IntelliSense</media:title>
		</media:content>
	</item>
		<item>
		<title>Updated Code: Visual Studio 2010 Beta2 Sample Data Project Templates</title>
		<link>http://karlshifflett.wordpress.com/2009/10/28/updated-code-visual-studio-2010-beta2-sample-data-project-templates/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/28/updated-code-visual-studio-2010-beta2-sample-data-project-templates/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 23:36:48 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Cider Designer]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/28/updated-code-visual-studio-2010-beta2-sample-data-project-templates/</guid>
		<description><![CDATA[I have updated the project templates Visual Studio 2010 Beta2 Sample Data Project Templates.&#160; 
The Silverlight template needed an update to the .proj file.
Please download the templates from the above post.
Sorry for the problem.
Close
Have a great day,
Just a grain of sand on the worlds beaches.
Posted in Cider Designer, CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1140&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have updated the project templates <font color="#333333"><a href="http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/">Visual Studio 2010 Beta2 Sample Data Project Templates</a>.&#160; </font></p>
<p><font color="#333333">The Silverlight template needed an update to the .proj file.</font></p>
<p>Please download the templates from the above post.</p>
<p>Sorry for the problem.</p>
<h4>Close</h4>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Cider Designer, CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1140&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/28/updated-code-visual-studio-2010-beta2-sample-data-project-templates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>Updated Code: XAML Power Toys for Visual Studio 2010 Beta2 Cider Designer</title>
		<link>http://karlshifflett.wordpress.com/2009/10/28/updated-code-xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/28/updated-code-xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 16:27:18 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Cider Designer]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>
		<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/28/updated-code-xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/</guid>
		<description><![CDATA[I was working on a post for T4 Preprocessed Text Templates (I’ll post it tonight) and found a bug in the XAML Power Toys for Visual Studio 2010 Beta2 Cider Designer grid parsing code.&#160; 
Chances are you won’t hit it, but I did so I’ve corrected the code and posted a new update.&#160; The code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1136&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was working on a post for T4 Preprocessed Text Templates (I’ll post it tonight) and found a bug in the <a href="http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/">XAML Power Toys for Visual Studio 2010 Beta2 Cider Designer</a> grid parsing code.&#160; </p>
<p>Chances are you won’t hit it, but I did so I’ve corrected the code and posted a new update.&#160; The code didn’t properly handle a null value in the CheckBox.Content property.&#160; I’ve correct it and added additional null checks.</p>
<p>Please visit this page <a href="http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/">XAML Power Toys for Visual Studio 2010 Beta2 Cider Designer</a> and get the latest version v1.0.1.</p>
<p>You can go to the above page, download the install files and install overtop as it will remove the previous version and install the new one.</p>
<p>Sorry for the bug.&#160; </p>
<h4>Close</h4>
<p>Hope you use and enjoy XAML Power Toys for Visual Studio 2010 Beta2 for Cider.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Cider Designer, CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF General, XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1136/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1136/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1136/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1136&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/28/updated-code-xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>d:DesignInstance, d:DesignData in Visual Studio 2010 Beta2</title>
		<link>http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 05:02:52 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Cider Designer]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/</guid>
		<description><![CDATA[The WPF and Silverlight Designer for Visual Studio 2010 shares several new design time (d:) properties and design time MarkupExtensions with Expression Blend 3 that provide necessary information for the WPF and Silverlight Designer to deliver a great editing experience.
I have explained the d:DesignData MarkupExtension in detail in this blog post:&#160; Visual Studio 2010 Beta2 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1129&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The WPF and Silverlight Designer for Visual Studio 2010 shares several new design time (d:) properties and design time MarkupExtensions with Expression Blend 3 that provide necessary information for the WPF and Silverlight Designer to deliver a great editing experience.</p>
<p>I have explained the d:DesignData MarkupExtension in detail in this blog post:&#160; <a href="http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/" target="_blank">Visual Studio 2010 Beta2 Sample Data Project Templates</a>.</p>
<p>In this post I’ll cover the d:DataContext property and the d:DesignInstance MarkupExtension.</p>
<h4>d:DataContext</h4>
<p>d:DataContext gives developers the ability to set a design time d:DataContext that is separate and independent of the run-time DataContext property. </p>
<p>This feature solves the problem of developers wanting to set their DataContext programmatically but also wanting design time data.</p>
<p>All d: properties are ignored during compilation and are not part of any run-time assemblies.</p>
<h4>d:DesignInstance</h4>
<p><strong>Purpose:</strong>&#160; Provides a design time shape to the d:DataContext its applied to.</p>
<p><strong>Example:&#160; </strong>In the below snippet the Person class is the shape provided by d:DesignInstance to the Grid’s d:DataContext.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">Grid </span><span style="color:red;">d</span><span style="color:blue;">:</span><span style="color:red;">DataContext</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">d</span><span style="color:blue;">:</span><span style="color:#a31515;">DesignInstance </span><span style="color:red;">local</span><span style="color:blue;">:</span><span style="color:red;">Person</span><span style="color:blue;">}&quot;&gt;
</span></pre>
</div>
<p><strong>Note: </strong>In the above example, the Person class is actually a faux type (fake or substitute type).&#160; This faux type enables types that are not creatable to be created and their properties exposed as a shape.&#160; See the below section on creating creatable types.</p>
<p><strong>Usage:</strong>&#160; So, now that the d:DataContext has shape, what can I do with it?</p>
<p>The shape is used by the new Binding Builder to expose the properties of the type in d:DataContext.&#160; You can see in the below image, the four properties exposed by the Person class.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/bindingbuilder.png"><img style="display:inline;border-width:0;" title="BindingBuilder" border="0" alt="BindingBuilder" src="http://karlshifflett.files.wordpress.com/2009/10/bindingbuilder_thumb.png?w=480&#038;h=467" width="480" height="467" /></a> </p>
<p>The Binding Builder is opened by clicking or right clicking on the Property Marker in the Properties Window.&#160; The Property Marker is the icon to the right of the property name.&#160; The Binding Builder is a GUI for editing bindings in WPF and Silverlight.&#160; This is a super feature</p>
<blockquote>
<p>The Cider Team has a great explanation of the new features on <a href="http://windowsclient.net/wpfdesigner/" target="_blank">WindowsClient.net</a> that you can read here: <a href="http://windowsclient.net/wpfdesigner/articles/visual-studio-setup.aspx" target="_blank">Setting Up Visual Studio for WPF and Silverlight Development</a>.&#160; There is an article and video.</p>
<p>You can read additional Cider Team Online material here:&#160; <a href="http://windowsclient.net/wpfdesigner/default.aspx" target="_blank">WPF and Silverlight Designer for Visual Studio 2010</a>.&#160; We are in the process of adding many more articles.&#160; While the material is initially geared for developers coming from other platforms to WPF or Silverlight, it has a lot of great information even for the seasoned XAML Head.&#160; Yea, I said it.&#160; I’m a XAML Head too and proud of it.&#160; (LOL)</p>
</blockquote>
<p>Without d:DesignInstance, d:DesignData or d:Source applied to a CollectionViewSource the Binding Builder would have no way to determine shape and provide a list of properties.</p>
<p><strong>Note:</strong>&#160; If d:DataContext is not set, but DataContext is set and has a created type assigned to it, this will also supply shape that the Binding Builder can use for listing properties.</p>
<h4>Creating Creatable Types</h4>
<div class="code">
<pre> <span style="color:blue;">&lt;</span><span style="color:#a31515;">Grid </span><span style="color:red;">d</span><span style="color:blue;">:</span><span style="color:red;">DataContext</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">d</span><span style="color:blue;">:</span><span style="color:#a31515;">DesignInstance </span><span style="color:red;">local</span><span style="color:blue;">:</span><span style="color:red;">Person</span><span style="color:blue;">, </span><span style="color:red;">IsDesignTimeCreatable</span><span style="color:blue;">=True}&quot;&gt;
</span></pre>
</div>
<p>d:DesignInstance provides a technique for creating a non-faux type.&#160; Setting the property IsDesignTimeCreatable to True on the d:DesignInstance MarkupExtension enables this.</p>
<h4>Links</h4>
<p><a href="http://msdn.microsoft.com/en-us/library/dd490796(VS.100).aspx" target="_blank">MSDN d:DesignInstance Walkthrough</a></p>
<p>Video showing d:DesignData and d:DesignInstance can be viewed from this blog post:&#160; <a title="Permanent Link: Visual Studio 2010 Beta2 Sample Data Project&#160;Templates" href="http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/">Visual Studio 2010 Beta2 Sample Data Project Templates</a>.</p>
<p><font color="#333333">The above post also has source code for sample data templates.&#160; There four of the templates are tutorial walkthroughs on this topic and sample data.</font></p>
<p>The two .xaml files in the DesignInstance Samples folder are the walkthroughs.&#160; You can create this project in VB.NET or C# by using one of the below templates when creating your project.</p>
<ul>
<li>VB WPF Application DesignData Sample – VB.NET Sample WPF Application that demonstrates consuming sample data. </li>
<li>CS WPF Application DesignData Sample – C# Sample WPF Application that demonstrates consuming sample data.</li>
</ul>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/designinstanceexamples.png"><img style="display:inline;border-width:0;" title="DesignInstanceExamples" border="0" alt="DesignInstanceExamples" src="http://karlshifflett.files.wordpress.com/2009/10/designinstanceexamples_thumb.png?w=266&#038;h=313" width="266" height="313" /></a> </p>
<h4>Close</h4>
<p>Hope you find d:DesignInstance and d:DesignData Sample Data in Visual Studio 2010 Beta2 a productive feature for your application development.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Cider Designer, CodeProject, Data Binding, Expression Blend, Silverlight, Tips, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1129&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/bindingbuilder_thumb.png" medium="image">
			<media:title type="html">BindingBuilder</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/designinstanceexamples_thumb.png" medium="image">
			<media:title type="html">DesignInstanceExamples</media:title>
		</media:content>
	</item>
		<item>
		<title>New Options for Visual Studio 2010 Beta2 WPF and Silverlight Projects</title>
		<link>http://karlshifflett.wordpress.com/2009/10/27/new-options-for-visual-studio-2010-beta2-wpf-and-silverlight-projects/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/27/new-options-for-visual-studio-2010-beta2-wpf-and-silverlight-projects/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 16:26:34 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF Controls]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/27/new-options-for-visual-studio-2010-beta2-wpf-and-silverlight-projects/</guid>
		<description><![CDATA[ 
To get to this Options dialog, use the Tools menu, selected Options, select Text Editors, select XAML, select Miscellaneous.
MarkupExtension IntelliSense and Editing
The most requested feature for the WPF &#38; Silverlight XAML Editor was MarkupExtension IntelliSense.&#160; This feature has been added to Visual Studio 2010 Beta2.
In addition to IntelliSense you also get some entry helpers.
1.&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1114&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://karlshifflett.files.wordpress.com/2009/10/tooloptions.png"><img style="display:inline;border-width:0;" title="ToolOptions" border="0" alt="ToolOptions" src="http://karlshifflett.files.wordpress.com/2009/10/tooloptions_thumb.png?w=700&#038;h=413" width="700" height="413" /></a> </p>
<p>To get to this Options dialog, use the Tools menu, selected Options, select Text Editors, select XAML, select Miscellaneous.</p>
<h4>MarkupExtension IntelliSense and Editing</h4>
<p>The most requested feature for the WPF &amp; Silverlight XAML Editor was MarkupExtension IntelliSense.&#160; This feature has been added to Visual Studio 2010 Beta2.</p>
<p>In addition to IntelliSense you also get some entry helpers.</p>
<p>1.&#160; When you type a { (left curly brace) Visual Studio will automatically insert the } (right curly brace) for you.&#160; </p>
<blockquote><p>You can disable this feature by un-checking the above option, “Closing braces for MarkupExtensions.”</p>
</blockquote>
<p>2.&#160; When you press the SPACEBAR inside {} (curly braces) Visual Studio will automatically insert a comma for you to the left of the space added by pressing the SPACEBAR.&#160; </p>
<blockquote><p>You can disable this feature by un-checking the above option, “Commas to separate MarkupExtension parameters.”</p>
</blockquote>
<h4>Toolbox Auto-Population</h4>
<p>Visual Studio 2010 Beta2 now adds all Custom Controls and UserControls in the Solution to the Toolbox when you build the solution.&#160; Control’s are added to a separate Toolbox tab for each project.&#160; </p>
<blockquote><p>You can disable this feature by un-checking the above option, “Automatically populate toolbox items.”</p>
</blockquote>
<p><strong>How Auto-Population Works</strong></p>
<p>When you build a project, its corresponding tab in the Toolbox is cleared and then all types that derive from FrameworkElement are added to the Toolbox tab for that project.&#160; (see Fine Print below for more details)</p>
<p>When you build the solution, all projects Toolbox tabs are updated as explained above.</p>
<blockquote><p>If you want to prevent an item from appearing in the Toolbox during the Auto-Population processing decorate the class with the System.ComponentModel.DesignTimeVisible attribute and pass False in the constructor.</p>
</blockquote>
<p>The following code snippet shows the DesignTimeVisible attribute decorating the CustomView UserControl.&#160; The CustomView UserControl will not appear in the Toolbox.</p>
<div class="code">
<pre><span style="color:blue;">Imports </span>System.ComponentModel

&lt;<span style="color:#2b91af;">DesignTimeVisible</span>(<span style="color:blue;">False</span>)&gt;
<span style="color:blue;">Public Class </span><span style="color:#2b91af;">CustomerView
    </span><span style="color:blue;">Inherits </span><span style="color:#2b91af;">UserControl

</span><span style="color:blue;">End Class</span></pre>
</div>
<p><strong>Fine Print</strong></p>
<p>To appear in the Auto-Population Toolbox process a type must derive from FrameworkElement and:</p>
<p>1.&#160; Are public and have a default public or internal constructor or are internal and have either a default public or internal constructor</p>
<p>3.&#160; Types deriving from Window or Page are ignored</p>
<p>4.&#160; FrameworkElements in other .exe projects are ignore</p>
<p>5.&#160; Internal classes will only be displayed when the active designer is for an item in the same project</p>
<p>6.&#160; Friend Assemblies are not taken into account for Toolbox Auto-Population</p>
<h4>Close</h4>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF Controls, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1114&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/27/new-options-for-visual-studio-2010-beta2-wpf-and-silverlight-projects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/tooloptions_thumb.png" medium="image">
			<media:title type="html">ToolOptions</media:title>
		</media:content>
	</item>
		<item>
		<title>XAML Power Toys for Visual Studio 2010 Beta2 Cider Designer</title>
		<link>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 22:29:35 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>
		<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/</guid>
		<description><![CDATA[Current Version 1.0.1, Last Update 28 October 2009

These last few weeks I’ve been writing control designers for Visual Studio 2010 Beta2 WPF and Silverlight controls.
Turns out this is much easier than I expected and is a lot of fun too!
This application is an example for writing a globalized WPF &#38; Silverlight platform neutral control designer.&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1104&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-family:calibri;color:#808080;font-size:small;">Current Version 1.0.1, Last Update 28 October 2009</span></p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/v1gridtoo.jpg"><img style="display:inline;" title="v1GridToo" alt="v1GridToo" src="http://karlshifflett.files.wordpress.com/2009/10/v1gridtoo_thumb.jpg?w=556&#038;h=611" width="556" height="611" /></a></p>
<p>These last few weeks I’ve been writing control designers for Visual Studio 2010 Beta2 WPF and Silverlight controls.</p>
<p>Turns out this is much easier than I expected and is a lot of fun too!</p>
<p>This application is an example for writing a globalized WPF &amp; Silverlight platform neutral control designer.&#160; Both WPF &amp; Silverlight applications use the same Design library.&#160; You can check out the source code to see how this is done.&#160; This source code is in VB.NET.&#160; Later this week, I’ll be posting another full featured article and code example in C# and VB.NET for writing a platform neutral control designer for WPF &amp; Silverlight custom controls.&#160; The project also includes two controls you can use in your projects.&#160; (Yes, Karl now speaks C#.&#160; Took about 2 days to pick it up.&#160; Still have to lookup some syntax but pretty fluent now.)</p>
<p>I must give credit where credit is due.&#160; I got a good bit of feedback and suggestions from my teammates on the Cider Team (WPF &amp; Silverlight Designer Team).&#160; Thanks Mark, Zhanbo, Bin, Pav, Marco, Ben&#160; and Ray.&#160; My great friend <a href="http://joshsmithonwpf.wordpress.com/" target="_blank">Josh Smith</a> also came over one day for some pair programming activities.&#160; Thanks Josh!</p>
<p>For those that care, the above designer is an MVVM application that is completely data driven from the ViewModel.</p>
<h4>Grid Layout Tool</h4>
<p>The Grid Layout Tool provides an abstract view of the selected Grid control in the designer that enables editing the Rows and Columns of the selected Grid.</p>
<p>The above image is the Grid Layout Tool that allows you to:</p>
<ul>
<li>Move (reorder) rows and columns </li>
<li>Move (reorder) multiple rows and columns (when multi-selected with CTRL+click) </li>
<li>Insert row or column before or after any row or column </li>
<li>Delete row or column </li>
<li>Set all row or all columns sizes using the TextBoxes at the top.&#160; Enter value and press ENTER. </li>
<li>Set individual row or column size by clicking the text value the Azure row or column headers and then editing them.&#160; Enter value and press ENTER. </li>
<li>To set size to auto type “a” or “auto” and press ENTER. </li>
<li>Designer is updated real time as you make your changes. </li>
<li>Clicking the “Save” button commits the changes into one Undo Transaction. </li>
<li>Clicking the “Cancel” button cancels all changes and puts the designer back in its original state. </li>
</ul>
<h4>Menu Options</h4>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/v1menu.jpg"><img style="display:inline;border-width:0;" title="v1Menu" border="0" alt="v1Menu" src="http://karlshifflett.files.wordpress.com/2009/10/v1menu_thumb.jpg?w=600&#038;h=322" width="600" height="322" /></a></p>
<p>This menu is only available when you have selected a GRID control in the WPF or Silverlight designer.</p>
<p><strong>Chainsaw – Leaves Alignment</strong></p>
<p>The chainsaw will remove all Margins, MinHeights, MinWidths and from CheckBox, RadioButton, Label, TextBlock will remove height and widths and on TextBox will remove height.&#160; Will set all Grid Rows to Auto.&#160; Will remove Name and x:Name if enabled.</p>
<p>Use this command if you do not have styles defined that determine layout for your form.&#160; (see video)</p>
<p><strong>Chainsaw – Clears Alignments</strong></p>
<p>The chainsaw will remove all HorizontalAlignments, VerticalAlignments, Margins, MinHeights, MinWidths and from CheckBox, RadioButton, Label, TextBlock will remove height and widths and on TextBox will remove height.&#160; Will set all Grid Rows to Auto.&#160; Will remove Name and x:Name if enabled.</p>
<p>Use this command is you have a styles defined that determines layout for your form.&#160; (see video)</p>
<p><strong>Modify Control Tags on Create</strong></p>
<p>If this option is checked the following controls will be affected when you create the control using the ToolBox.</p>
<p>StackPanel and Grid – Alignments and Name cleared&#160; (note: when the StackPanel is created inside a GroupBox or Expander, the tag modifications are ignored and overridden by the designer.)</p>
<p>TextBox, TextBlock, Label, CheckBox, RadioButton – smaller sizes than the Visual Studio defaults and Named is cleared.&#160; The smaller sizes widths were 120, now 80, except TextBox which is 100.&#160; You can play around with control creation to see if this makes sense for you.</p>
<p><strong>Modify Control Tags and Chainsaw Clears Name</strong></p>
<p>If you want control names cleared by the Chainsaw or the control Modify Control Tags on Create feature check this menu option.&#160; To turn off name clearing, uncheck this menu option.</p>
<h4>Video</h4>
<p>PLEASE view this short tutorial video.&#160; You will get a full and quick understanding of this great feature.</p>
<p>This video is on my SkyDrive.&#160; Silverlight Streaming is being discontinued and won’t let me upload any more video files.&#160; Like many others, I’m trying to find an alternate location to host all my training videos.&#160; Relocating and re-pointing all my videos will be a huge PIA.&#160; Any suggestions for hosting would be greatly appreciated.</p>
<p>The below video can be downloaded and viewed.&#160; Click the link to be taken to my SkyDrive.</p>
<p><img src="http://karlshifflett.files.wordpress.com/2008/01/movie1.gif" />&#160; <a href="http://cid-51de981e071f222b.skydrive.live.com/browse.aspx/Public/XAML%20Power%20Toys%202010%20for%20Cider" target="_blank">XAML Power Toys 2010 Beta2 for Cider Tutorial Video (13 minutes)</a></p>
<h4>Downloads – Visual Studio 2010 Beta2 ONLY</h4>
<p>This software will not work in the final release of Visual Studio 2010.&#160; That includes RC/RTM releases.&#160; I will release a new version when RC (release candidates) are published.</p>
<p><font color="#800000"><strong>Remember</strong> – Please <strong><u>build your projects</u></strong> before attempting to create forms, ViewModels or using the Field List</font>.</p>
<p>Please set your <strong>Control Defaults</strong> after installing, new options have been added.</p>
<p>Download now comes from my Windows Live Sky Drive.</p>
<blockquote><p><u><strong>Microsoft employees</strong> please read this</u>:</p>
<p>If you are using the final Beta2 release these links and this software will work for you.</p>
<p>If not please&#160; email me and I’ll send you an internal drop location you can get this software from.&#160; (Just look me up in the Global address book.)</p>
</blockquote>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/XAML%20Power%20Toys%202010%20for%20Cider/XAMLPowerToys2010ForCider-1-0-1Release.zip" target="_blank">XAML Power Toys 2010 for Cider &#8211; for Visual Studio 2010 Beta2 v1.0.1 Release (459 KB)</a></p>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/XAML%20Power%20Toys%202010%20for%20Cider/XAMLPowerToys2010ForCider-1-0-1Source.zip" target="_blank">XAML Power Toys 2010 for Cider &#8211; for Visual Studio 2010 Beta2 v1.0.1 Source Code not required (85 KB)</a></p>
<p><strong>Alternate Download Site</strong></p>
<p>Some corporate firewalls do not allow access to Windows Live Sky Drive.&#160; You can download the installer here.&#160; Remember to rename the file from .doc to .zip.&#160; This is a requirement of WordPress.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/xamlpowertoys2010forcider-1-0-1release-zip.doc" target="_blank">XAML Power Toys 2010 for Cider &#8211; for Visual Studio 2010 Beta2 v1.0.1 Release (459 KB)</a></p>
<h4>Your Feedback</h4>
<p>I can’t not over emphasize the the importance and the weight of your feedback on this block post.&#160; My team (Cider Team that delivers the WPF &amp; Silverlight Designer) is eager to hear from customers on features you need in the WPF &amp; Silverlight Designer and XAML Editor.</p>
<h4>Close</h4>
<p>Hope you use and enjoy XAML Power Toys for Visual Studio 2010 Beta2 for Cider.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, VB.NET, Visual Studio 2010, WPF General, XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1104&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2-cider-designer/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/v1gridtoo_thumb.jpg" medium="image">
			<media:title type="html">v1GridToo</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/v1menu_thumb.jpg" medium="image">
			<media:title type="html">v1Menu</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2008/01/movie1.gif" medium="image" />
	</item>
		<item>
		<title>XAML Power Toys for Visual Studio 2010 Beta2</title>
		<link>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:44:10 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>
		<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2/</guid>
		<description><![CDATA[This post is the home page for XAML Power Toys for Visual Studio 2010 Beta2.&#160; Please post all comments and suggestions for this version on this post.
XAML Power Toys for Visual Studio 2010 has all the same features as XAML Power Toys for Visual Studio 2008 except as noted below.&#160; Please use the XAML Power [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1094&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This post is the home page for XAML Power Toys for Visual Studio 2010 Beta2.&#160; Please post all comments and suggestions for this version on this post.</p>
<p>XAML Power Toys for Visual Studio 2010 has all the same features as <a href="http://karlshifflett.wordpress.com/xaml-power-toys/" target="_blank">XAML Power Toys for Visual Studio 2008</a> except as noted below.&#160; Please use the <a href="http://karlshifflett.wordpress.com/xaml-power-toys/" target="_blank">XAML Power Toys for Visual Studio 2008</a> page as a reference for how the the features work.&#160; Please download this version of the software below. </p>
<p>During development of XAML Power Toys for Beta2 I ran into some bugs that are being corrected for the final release of Visual Studio 2010.&#160; As a result I had to cut a few features for this release.</p>
<p>The below image displays the menu for XAML Power Toys for Visual Studio 2010 Beta2.&#160; Users of the 2008 version will notice the “Group Into” submenu is gone; the “Tools” submenu is gone and that “Create ViewModel for Class” is displayed in the this submenu but it shouldn’t.</p>
<p>The bottom line is, submenus are broken in Beta2 and there is no known workaround.</p>
<p>Notice I have moved “Set Control Defaults” and “About” features from the “Tools” submenu to this submenu.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/xpt2010menu.png"><img style="display:inline;border-width:0;" title="XPT2010Menu" border="0" alt="XPT2010Menu" src="http://karlshifflett.files.wordpress.com/2009/10/xpt2010menu_thumb.png?w=686&#038;h=274" width="686" height="274" /></a> </p>
<p>The other grayed out menu options are not enabled because no XAML was selected when the screen shot was taken.&#160; All features on this menu work as advertised.&#160; “Create ViewModel for Class” just displays here in error and will never be enabled.&#160; It does work correctly in the C# and VB.NET Code Windows.</p>
<p>The good news is, the above software has been updated and works great in Visual Studio 2010 Beta2.</p>
<p>When the final release of Visual Studio 2010 is public I will release a new version without these limitations.</p>
<h4>Downloads – Visual Studio 2010 Beta2 ONLY</h4>
<p><font color="#800000"><strong>Remember</strong> – Please <strong><u>build your projects</u></strong> before attempting to create forms, ViewModels or using the Field List</font>.</p>
<p>Please set your <strong>Control Defaults</strong> after installing, new options have been added.</p>
<p>Download now comes from my Windows Live Sky Drive.</p>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/XAML%20Power%20Toys%202010/XAMLPowerToys2010-5-1-0001Release.zip" target="_blank">Download XAML Power Toys for Visual Studio 2010 Beta2 v5.1.0001 Release Installer (809 KB)</a></p>
<p><a href="http://cid-51de981e071f222b.skydrive.live.com/self.aspx/Public/XAML%20Power%20Toys%202010/XAMLPowerToys2010-5-1-0001Source.zip" target="_blank">Download XAML Power Toys for Visual Studio 2010 Beta2 v5.1.0001 Source Code not required (594 KB)</a></p>
<p><strong>Alternate Download Site</strong></p>
<p>Some corporate firewalls do not allow access to Windows Live Sky Drive.&#160; You can download the installer here.&#160; Remember to rename the file from .doc to .zip.&#160; This is a requirement of WordPress.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/xamlpowertoys2010-5-1-0001release-zip.doc" target="_blank">Download XAML Power Toys for Visual Studio 2010 Beta2 v5.1.0001 Release Installer (809 KB)</a></p>
<h4>Visual Studio 2010 Beta2 Known Issues</h4>
<p>The below issues are known, being worked on and will be fixed for the RC/RTM milestone.</p>
<p><strong>1.&#160; Can’t Add Menu inside an AddIn</strong></p>
<p>This problem was first reported on MS Connect.&#160; </p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=462766&amp;wa=wsignin1.0" target="_blank">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=462766&amp;wa=wsignin1.0</a></p>
<p>&#160; <a href="http://karlshifflett.files.wordpress.com/2009/10/referencesbug1.jpg"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="ReferencesBug" border="0" alt="ReferencesBug" src="http://karlshifflett.files.wordpress.com/2009/10/referencesbug_thumb1.jpg?w=700&#038;h=149" width="700" height="149" /></a> </p>
<p>The workaround for this bug is to set the “Embod Interop Types” property to False for the “Microsoft.VisualStudio.CommandBars 8.0 Reference”</p>
<p><strong>2.&#160; Submenus keep repeating</strong></p>
<p>When adding a submenu to a menu you have added in an AddIn, the submenus will repeat the entire menu tree instead of just showing the submenu items.</p>
<p>This is why I had to remove the “Group Into” submenu and features.&#160; The submenus were simply unusable.</p>
<p><strong>3.&#160; Setup project “Client Framework” problems</strong></p>
<p>When I first compiled the Setup project for this release, upon installation I kept getting a message that I had to install the .NET 4.0 Framework.&#160; Obviously the full .NET framework was installed on the machine.</p>
<p>The only way I could get the message to not show up when running the Setup.exe, was to remove all references to the “Client Framework” within the solution.</p>
<p>Remember, in Visual Studio 2010 Beta2 all WPF and Class Library projects will by default target the “.NET 4.0 Client Framework.”&#160; This is a good thing as it makes application distribution and installation easier for customers of your applications. </p>
<p>However, in this Beta2 release, to get the files to install from the output of the Setup project I had to remove all references to the “Client Framework.”</p>
<h4>Close</h4>
<p>Hope you use and enjoy XAML Power Toys for Visual Studio 2010 Beta2. </p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, VB.NET, Visual Studio 2010, WPF General, XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1094/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1094/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1094/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1094&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2010-beta2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/xpt2010menu_thumb.png" medium="image">
			<media:title type="html">XPT2010Menu</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/referencesbug_thumb1.jpg" medium="image">
			<media:title type="html">ReferencesBug</media:title>
		</media:content>
	</item>
		<item>
		<title>XAML Power Toys for Visual Studio 2008 v5.0.0.1 Released</title>
		<link>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2008-v5-0-0-1-released/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2008-v5-0-0-1-released/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 17:50:20 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[M-V-VM]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[WPF General]]></category>
		<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2008-v5-0-0-1-released/</guid>
		<description><![CDATA[At the request of a XAML Power Toys user I have updated XAML Power Toys for Visual Studio 2008 to version v5.0.0.01.
This update adds one new feature and corrects the v5 known issue.
The ViewModel creation window now allows selecting the name of the method that is used to raise the&#160; PropertyChanged event.&#160; You can thank [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1088&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>At the request of a XAML Power Toys user I have updated XAML Power Toys for Visual Studio 2008 to version v5.0.0.01.</p>
<p>This update adds one new feature and corrects the v5 known issue.</p>
<p>The ViewModel creation window now allows selecting the name of the method that is used to raise the&#160; PropertyChanged event.&#160; You can thank Ted Warring for the suggestion.&#160; Awesome Ted, appreciate the feedback and feature suggestion.</p>
<h4>ViewModel Creator Gets New Feature</h4>
<p>The ViewModel creator tool makes building a ViewModel class a snap.&#160; This feature is sensitive to C# and VB.NET and will create the correct code for you.</p>
<p>The yellow highlight indicates the new feature added in v5.0.0.1.&#160; You can now select or type in the name of the method that will be called when raising a PropertyChanged event.</p>
<p>This name value is also used if you selected the Implement INotifyPropertyChanged option.</p>
<p>This name feature enables you to use any name in your ViewModel base classes and have the generated code us it.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/v5001viewmodel1.jpg"><img style="display:inline;border-width:0;" title="v5001ViewModel" border="0" alt="v5001ViewModel" src="http://karlshifflett.files.wordpress.com/2009/10/v5001viewmodel_thumb1.jpg?w=689&#038;h=744" width="689" height="744" /></a> </p>
<p>As always, you can download XAML Power Toys for Visual Studio 2008 here:</p>
<p><a href="http://karlshifflett.wordpress.com/xaml-power-toys/">http://karlshifflett.wordpress.com/xaml-power-toys/</a></p>
<h4>Close</h4>
<p>Hope you use and enjoy XAML Power Toys for Visual Studio 2008. </p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, M-V-VM, MVVM, VB.NET, Visual Studio 2008, WPF General, XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1088/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1088/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1088/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1088/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1088/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1088/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1088/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1088/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1088/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1088/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1088&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/25/xaml-power-toys-for-visual-studio-2008-v5-0-0-1-released/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/v5001viewmodel_thumb1.jpg" medium="image">
			<media:title type="html">v5001ViewModel</media:title>
		</media:content>
	</item>
		<item>
		<title>Much Improved .NET 4.0 WPF Text Rendering</title>
		<link>http://karlshifflett.wordpress.com/2009/10/22/much-improved-net-4-0-wpf-text-rendering/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/22/much-improved-net-4-0-wpf-text-rendering/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 20:50:04 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Cider Designer]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/22/much-improved-net-4-0-wpf-text-rendering/</guid>
		<description><![CDATA[In .NET 4.0 WPF text rendering has been greatly improved.
However this new feature is not enabled by default.
You can read the complete feature write up on the WPF Text Blog.
The scenario where you get the most payback for using this feature is with text that is sized 15pt and below.
Line of Business forms containing TextBlocks, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1077&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In .NET 4.0 WPF text rendering has been greatly improved.</p>
<p>However this new feature is not enabled by default.</p>
<p>You can read the complete feature write up on the <a href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" target="_blank">WPF Text Blog</a>.</p>
<p>The scenario where you get the most payback for using this feature is with text that is sized 15pt and below.</p>
<p>Line of Business forms containing TextBlocks, Labels, CheckBoxes, RadioButtons, Buttons and TextBoxes will have FontSizes below 15pt and will receive the most benefit of this new feature.</p>
<p>The feature is enabled by placing the “TextOptions.TextFormattingMode” attached property on the UI Element or on a parent UI Element.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">TextBlock </span><span style="color:red;">Text</span><span style="color:blue;">=&quot;.NET 3.5 rendering&quot; /&gt;

&lt;</span><span style="color:#a31515;">TextBlock </span><span style="color:red;">Text</span><span style="color:blue;">=&quot;.NET 4.0 improved rendering&quot; </span><span style="color:red;">TextOptions.TextFormattingMode</span><span style="color:blue;">=&quot;Display&quot; /&gt;</span></pre>
</div>
<p>The below XAML demonstrates how to have all text rendering use the new text rendering feature by placing the “TextOptions.TextFormattingMode” attached property on the Window.</p>
<p>In the below example, all child controls of the Window will use the new text rendering.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">Window </span><span style="color:red;">x</span><span style="color:blue;">:</span><span style="color:red;">Class</span><span style="color:blue;">=&quot;MainWindow&quot;
    </span><span style="color:red;">xmlns</span><span style="color:blue;">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    </span><span style="color:red;">xmlns</span><span style="color:blue;">:</span><span style="color:red;">x</span><span style="color:blue;">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    </span><span style="color:red;">Title</span><span style="color:blue;">=&quot;MainWindow&quot; </span><span style="color:red;">Height</span><span style="color:blue;">=&quot;350&quot; </span><span style="color:red;">Width</span><span style="color:blue;">=&quot;525&quot;
    </span><span style="color:red;">TextOptions.TextFormattingMode</span><span style="color:blue;">=&quot;Display&quot;&gt;
    &lt;</span><span style="color:#a31515;">Grid</span><span style="color:blue;">&gt;

        &lt;</span><span style="color:#a31515;">TextBlock </span><span style="color:red;">Text</span><span style="color:blue;">=&quot;Inherited the .NET 4.0 improved rendering&quot; /&gt;

    &lt;/</span><span style="color:#a31515;">Grid</span><span style="color:blue;">&gt;
&lt;/</span><span style="color:#a31515;">Window</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>Visual Studio 2010 Beta2 and .NET 4.0 have a lot of new goodness, go check it out!</p>
<p>Have a great day,</p>
</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Cider Designer, CodeProject, VB.NET, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1077/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1077/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1077/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1077/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1077/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1077/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1077/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1077/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1077/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1077/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1077&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/22/much-improved-net-4-0-wpf-text-rendering/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 2010 Beta2 Sample Data Project Templates</title>
		<link>http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 01:26:00 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[WPF General]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/</guid>
		<description><![CDATA[Silverlight 3 application demonstrating Sample Data.

Displaying Sample Data in the WPF and Silverlight Designer for Visual Studio 2010 Beta2 is now very easy with the design time DesignData markup extension.
The below video is a complete tutorial for using Sample Data in your WPF and Silverlight applications.&#160; Please take a view few minutes to view it.
The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1076&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Silverlight 3 application demonstrating Sample Data.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/silverlightsampledata.png"><img style="display:inline;border-width:0;" title="SilverlightSampleData" border="0" alt="SilverlightSampleData" src="http://karlshifflett.files.wordpress.com/2009/10/silverlightsampledata_thumb.png?w=700&#038;h=285" width="700" height="285" /></a></p>
<p>Displaying Sample Data in the WPF and Silverlight Designer for Visual Studio 2010 Beta2 is now very easy with the design time DesignData markup extension.</p>
<p>The below video is a complete tutorial for using Sample Data in your WPF and Silverlight applications.&#160; <u>Please</u> take a view few minutes to view it.</p>
<p>The Sample Application templates have many comments in them, walking you through Sample Data.&#160; <u>Please</u> take a few minutes and review the projects created by the Sample Application Templates.</p>
<h4>Beta2 Template Information</h4>
<p>For Beta2, you need to use these templates to consume sample data in your projects.&#160; The reason is the winfx.targets file for was not updated with the Sample Data Build Actions in time for Beta2.</p>
<p>These project files have been modified to include the DesignData Build Action for the Sample Data files.&#160; All Sample Data files must have their Build Action set to DesignData in the properties window.</p>
<p>These templates will not be required for the final version of Visual Studio 2010.</p>
<p>There are really two templates.</p>
<p>1.&#160; &lt;Language&gt; &lt;Platform&gt; Empty Application – this template consists of an empty project file and the added Build Action DesignData.</p>
<p>2.&#160; &lt;Language&gt; &lt;Platform&gt; Sample Application – this template consists of a sample application that has sample data files and a UserControl that demonstrates how to consume the sample data.&#160; It also includes the added Build Action DesignData.</p>
<h4>WPF Templates</h4>
<p>VB WPF Application DesignData – Empty VB.NET WPF Application template with sample data support.</p>
<p>VB WPF Application DesignData Sample – VB.NET Sample WPF Application that demonstrates consuming sample data.</p>
<p>CS WPF Application DesignData – Empty C# WPF Application template with sample data support.</p>
<p>CS WPF Application DesignData Sample – C# Sample WPF Application that demonstrates consuming sample data.</p>
<h4>Silverlight Templates</h4>
<p>VB SL Application DesignData – Empty VB.NET SL Application template with sample data support.</p>
<p>VB SL Application DesignData Sample – VB.NET Sample SL Application that demonstrates consuming sample data.</p>
<p>CS SL Application DesignData – Empty C# SL Application template with sample data support.</p>
<p>CS SL Application DesignData Sample – C# Sample SL Application that demonstrates consuming sample data.</p>
<h4>Sample Application Template Usage</h4>
<p>The WPF and Silverlight sample application template creates an application complete with sample data files, entity classes, a UserControl consuming the sample data files and</p>
<h4>xmlns:d – How To Easily Add The d: Namespace</h4>
<p>All design time properties live in a design time namespace that is part of this schema: http://schemas.microsoft.com/expression/blend/2008.</p>
<p>Examples of design time properties are, d:DesignWidth, d:DesignHeight, d:DesignInstance, d:DesignData, d:DataContext, d:Source.</p>
<p>In order to use the d: properties you must have a xmlns declaration in your XAML.&#160; In Visual Studio 2010 there is a very easy way to add it to a Window, UserControl or Page .xmal file.</p>
<p>If you select the root control, you’ll see a Root Size Mode button displayed in the lower right hand corner.&#160; Clicking this button changes the size mode of your root container from Auto to Fixed or from Fixed to Auto.</p>
<p>If the d: namespace has not been added to the root control yet, clicking this button will do it for you.&#160; In addition to the d: namespace, mc: is added and the mc:Ignorable is added also.</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/autosizedroot.png"><img style="display:inline;border-width:0;" title="AutoSizedRoot" border="0" alt="AutoSizedRoot" src="http://karlshifflett.files.wordpress.com/2009/10/autosizedroot_thumb.png?w=402&#038;h=244" width="402" height="244" /></a></p>
<p>I have modified each of the starter templates below to automatically add this for you.&#160; However, as you add new Windows, Pages or UserControls, those templates may not have the d: namespace declarations, so the above trick comes in handy.</p>
<h4>Adding a New Sample Data File</h4>
<p>Open an existing Sample Data project or Create a new project using one of the Sample Data templates.</p>
<p>Add a resource dictionary to the project naming it &lt;my entity class name&gt;SampleData.xaml.</p>
<p>For example:&#160; Customer sample data file would be named, “CustomerSampleData.xaml”</p>
<p>The the file properties as pictured below:</p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/sampledatasettings.png"><img style="display:inline;border-width:0;" title="SampleDataSettings" border="0" alt="SampleDataSettings" src="http://karlshifflett.files.wordpress.com/2009/10/sampledatasettings_thumb.png?w=403&#038;h=320" width="403" height="320" /></a></p>
<p>Build Action: DesignData</p>
<p>Copy to Output Directory: Do not copy</p>
<p>Custom Too:&#160; &lt;blank&gt;</p>
<h4>Editing a New Sample Data File</h4>
<p>This is an example of a single instance sample data file.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">local</span><span style="color:blue;">:</span><span style="color:#a31515;">Customer
    </span><span style="color:red;">xmlns</span><span style="color:blue;">:</span><span style="color:red;">local</span><span style="color:blue;">=&quot;clr-namespace:WPFApplication2&quot;
    </span><span style="color:red;">Age</span><span style="color:blue;">=&quot;21&quot; </span><span style="color:red;">Email</span><span style="color:blue;">=&quot;jim@hotmail.com&quot;
    </span><span style="color:red;">FirstName</span><span style="color:blue;">=&quot;Jim&quot; </span><span style="color:red;">LastName</span><span style="color:blue;">=&quot;Smith&quot; /&gt;</span></pre>
</div>
<p>Sample Data files allow you to construct your objects in XAML.&#160; You can set the required properties as illustrated above.</p>
<p>The below code illustrates how to create a collection of items in a sample data file.</p>
<div class="code">
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">local</span><span style="color:blue;">:</span><span style="color:#a31515;">Customers </span><span style="color:red;">xmlns</span><span style="color:blue;">:</span><span style="color:red;">local</span><span style="color:blue;">=&quot;clr-namespace:WPFApplication2&quot;&gt;
    &lt;</span><span style="color:#a31515;">local</span><span style="color:blue;">:</span><span style="color:#a31515;">Customer
        </span><span style="color:red;">Age</span><span style="color:blue;">=&quot;21&quot; </span><span style="color:red;">Email</span><span style="color:blue;">=&quot;jim@hotmail.com&quot;
        </span><span style="color:red;">FirstName</span><span style="color:blue;">=&quot;Jim&quot; </span><span style="color:red;">LastName</span><span style="color:blue;">=&quot;Smith&quot; /&gt;
    &lt;</span><span style="color:#a31515;">local</span><span style="color:blue;">:</span><span style="color:#a31515;">Customer
        </span><span style="color:red;">Age</span><span style="color:blue;">=&quot;22&quot; </span><span style="color:red;">Email</span><span style="color:blue;">=&quot;jane@hotmail.com&quot;
        </span><span style="color:red;">FirstName</span><span style="color:blue;">=&quot;Jane&quot; </span><span style="color:red;">LastName</span><span style="color:blue;">=&quot;Smith&quot; /&gt;
&lt;/</span><span style="color:#a31515;">local</span><span style="color:blue;">:</span><span style="color:#a31515;">Customers</span><span style="color:blue;">&gt;
</span></pre>
</div>
<p>The above Customers class derives from the Generic List of Customer.</p>
<h4>Consuming Sample Data in WPF</h4>
<div class="code">
<pre><span style="color:green;">&lt;!-- DataGrid Sample--&gt;
</span><span style="color:blue;">&lt;</span><span style="color:#a31515;">Grid </span><span style="color:red;">d</span><span style="color:blue;">:</span><span style="color:red;">DataContext</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">d</span><span style="color:blue;">:</span><span style="color:#a31515;">DesignData </span><span style="color:red;">Source</span><span style="color:blue;">=</span>/<span style="color:blue;">SampleData</span>/<span style="color:blue;">PeopleSampleData.xaml}&quot;
      </span><span style="color:red;">Grid.Row</span><span style="color:blue;">=&quot;1&quot; </span><span style="color:red;">Margin</span><span style="color:blue;">=&quot;7&quot;&gt;
    &lt;</span><span style="color:#a31515;">DataGrid </span><span style="color:red;">ItemsSource</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">Binding</span><span style="color:blue;">}&quot;/&gt;
&lt;/</span><span style="color:#a31515;">Grid</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>Sample Data is exposed through the d:DataContext design time property.&#160; Design time properties are not compiled into your applications.</p>
<p>In WPF this is how you start at the root, navigate to SampleData folder and get the xaml file.</p>
<h4>Consuming Sample Data in Silverlight</h4>
<div class="code">
<pre><span style="color:green;">&lt;!-- DataGrid Sample--&gt;
</span><span style="color:blue;">&lt;</span><span style="color:#a31515;">Grid </span><span style="color:red;">d</span><span style="color:blue;">:</span><span style="color:red;">DataContext</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">d</span><span style="color:blue;">:</span><span style="color:#a31515;">DesignData </span><span style="color:red;">Source</span><span style="color:blue;">=..</span>/<span style="color:blue;">SampleData</span>/<span style="color:blue;">PeopleCollectionSampleData.xaml}&quot;
      </span><span style="color:red;">Grid.Row</span><span style="color:blue;">=&quot;1&quot; </span><span style="color:red;">Margin</span><span style="color:blue;">=&quot;7&quot;&gt;
    &lt;</span><span style="color:#a31515;">data</span><span style="color:blue;">:</span><span style="color:#a31515;">DataGrid </span><span style="color:red;">ItemsSource</span><span style="color:blue;">=&quot;{</span><span style="color:#a31515;">Binding</span><span style="color:blue;">}&quot;/&gt;
&lt;/</span><span style="color:#a31515;">Grid</span><span style="color:blue;">&gt;
</span></pre>
</div>
<p>In Silverlight you have to ../ up to the root, then navigate to SampleData folder and get the xaml file.</p>
<p>Slight difference between WPF and Silverlight.</p>
<h4>Video</h4>
<p>PLEASE view this short tutorial video.&#160; You will get a full and quick understanding of this great feature.</p>
<p>This video link supports right click, save as…</p>
<p><img src="http://karlshifflett.files.wordpress.com/2008/01/movie1.gif" />&#160; <a href="http://silverlight.services.live.com/48184/Sample%20Data%20Introduction/video.wmv" target="_blank">Sample Data Tutorial Video (22 minutes)</a></p>
<h4>Installing Templates Using The Download</h4>
<p><strong>For VB.NET</strong> copy the download to:</p>
<p>C:\users\&lt;your user name&gt;\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual Basic</p>
<p>Unzip the download in this folder.&#160; You should have 4 zip files in the folder.&#160; You are ready to go.</p>
<p><strong>For C# </strong>copy the download to:</p>
<p>C:\users\&lt;your user name&gt;\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#</p>
<p>Unzip the download in this folder.&#160; You should have 4 zip files in the folder.&#160; You are ready to go.</p>
<h4>Downloads</h4>
<p>After downloading one or both template downloads, you’ll need to rename the file extension from .doc to .zip.&#160; This is a requirement of WordPress.com.</p>
<p><font color="#ff0000"><strong>Requires</strong></font>:&#160; Visual Studio 2010 <strong>Beta2</strong></p>
<p>Silverlight Templates require:&#160; <strong>Silverlight 3</strong></p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/vbsampledatatemplates-10-28-2009-zip.doc" target="_blank">VB.NET Project Templates (61KB) (updated 10-28-2009)</a></p>
<p><a href="http://karlshifflett.files.wordpress.com/2009/10/cssampledatatemplates-10-28-2009-zip.doc" target="_blank">C# Project Templates (58KB) (updated 10-28-2009)</a></p>
<h4>Installing Templates From Within Visual Studio 2010 Beta2</h4>
<p>The sample data templates are also be individually available on the Visual Studio Code Gallery.</p>
<p>To use a single template open the New Project Dialog and select the Online Templates tab at the bottom left.&#160; You can browse all available templates or search for “design” and all the templates will be listed.</p>
<h4>Close</h4>
<p>Hope you use and enjoy Sample Data in Visual Studio 2010 Beta2.</p>
<p>Gentle reminder, please watch the above video too.</p>
<p>Have a great day,</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, Silverlight, VB.NET, Videos, Visual Studio 2010, WPF General  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1076/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1076&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/21/visual-studio-2010-beta2-sample-data-project-templates/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://silverlight.services.live.com/48184/Sample%20Data%20Introduction/video.wmv" length="40998649" type="audio/x-ms-wmv" />
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/silverlightsampledata_thumb.png" medium="image">
			<media:title type="html">SilverlightSampleData</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/autosizedroot_thumb.png" medium="image">
			<media:title type="html">AutoSizedRoot</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2009/10/sampledatasettings_thumb.png" medium="image">
			<media:title type="html">SampleDataSettings</media:title>
		</media:content>

		<media:content url="http://karlshifflett.files.wordpress.com/2008/01/movie1.gif" medium="image" />
	</item>
		<item>
		<title>Developers &#8211; Must Learn &#8211; Booting Windows 7 from a VHD</title>
		<link>http://karlshifflett.wordpress.com/2009/10/09/developers-must-learn-booting-windows-7-from-a-vhd/</link>
		<comments>http://karlshifflett.wordpress.com/2009/10/09/developers-must-learn-booting-windows-7-from-a-vhd/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 06:42:00 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Did You Know]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/10/09/developers-must-learn-booting-windows-7-from-a-vhd/</guid>
		<description><![CDATA[For the past few months I’ve been sharpening my Windows 7 skills and discovered what many systems people already know; “you can easily setup and boot Windows 7 or Server 2008 R2 VHD.”
Someone may already be thinking, why do I need to boot a VHD?
It’s no secret that Microsoft will be shipping Visual Studio 2010 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1071&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For the past few months I’ve been sharpening my Windows 7 skills and discovered what many systems people already know; “you can easily setup and boot Windows 7 or Server 2008 R2 VHD.”</p>
<p>Someone may already be thinking, why do I need to boot a VHD?</p>
<p>It’s no secret that Microsoft will be shipping Visual Studio 2010 Beta2.&#160; If you want to be notified when Beta2 ships you can sign up here:&#160; <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target="_blank">http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx</a></p>
<p>Some developers prefer to install beta software on a non-production machine or set up a multi-boot box.</p>
<p>This is where VHD’s come into play.&#160; You can setup a VHD on your desktop or laptop, then from the boot menu, select to boot that VHD or boot the operating system.&#160; I’ve been doing this at home and work for awhile now and love it.</p>
<p>VHD’s also enable you to have a x32 O/S boot and a x64 O/S boot on the same machine.&#160;&#160; Possibilities are endless.</p>
<p>When you’re done with the VHD, just delete it and make a new one.</p>
<p>VHD’s sport great performance.&#160; If you use the <strong>fixed size</strong> VHD, the total performance cost is 3%.&#160; When I boot a VHD on my laptop I don’t see any drop in performance from booting the original O/S.</p>
<p>VHD’s do not require Hyper-V to boot them.&#160; Server 2008 R2 does have a Hyper-V feature that allows you to log onto a VHD.&#160; But what I’m explaining here does not require Hyper-V.&#160; This is why I love this feature, it just works. </p>
<h4>Recommendations </h4>
<p>Before creating a new VHD, defrag the volume you want to add the VHD to.</p>
<p>I always create a fixed size VHD to ensure maximum performance.&#160; Dynamic sized VHD’s offer flexibility with respect to size but pay a performance hit.</p>
<p>I’ve been allocating 45GB for all my VHDs.&#160; This leaves plenty of room for Windows 7, Visual Studio, Microsoft Office and other applications and data on the VHD.&#160; After you have created and configured a few of these, you’ll determine what works best for you.</p>
<p>I created a c:\vhd folder and locate all my VHD files here.</p>
<h4>Possible Configuration Scenarios</h4>
<p>Computer has Windows 7 or Server 2008 R2 installed and one or more Windows 7 or Server 2008 R2 VHD’s.</p>
<p>Computer does not have any O/S installed, but has one or more VHD’s that can be booted.&#160; How cool is this?</p>
<h4>Possible VHD Installation Options</h4>
<p>Create a new VHD and install Windows 7 from a DVD or network location.</p>
<p>Create a new VHD and use imagex.exe to restore a .wim file to the VHD.&#160; This is my favorite.&#160; This saves so much time.&#160; You install an O/S, configure it and install all the other software you need (except Visual Studio).&#160; Then use imagex.exe to save a copy of the O/S and software to a .wim file.&#160; You can then use imagex.exe to restore that .wim file to a VHD or if you need to a boot partition.&#160; I do this at work every 1-2 weeks.&#160; Takes a few minutes to pave my box.&#160; Awesome software imagex.exe is!</p>
<p>On my laptop and desktop systems, I keep an extra VHD file that is all ready to go.&#160; It’s configured and has all the software I need except Visual Studio.&#160; Then when I want to load up another version of Visual Studio, I copy the files I need, delete the old VHD, copy the standby VHD to another new VHD, boot the new one and install Visual Studio.&#160; Even on my laptop with the 45GB file copy and installing a new Visual Studio I’m up and running quickly.</p>
<h4>Imagex.exe</h4>
<p>What is imagex.exe?&#160; Read this: <a href="http://technet.microsoft.com/en-us/library/cc507842.aspx" target="_blank">http://technet.microsoft.com/en-us/library/cc507842.aspx</a></p>
<p>Where can I get imagex.exe?&#160; Here: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=696DD665-9F76-4177-A811-39C26D3B3B34&amp;displaylang=en" target="_blank">http://www.microsoft.com/downloads/details.aspx?familyid=696DD665-9F76-4177-A811-39C26D3B3B34&amp;displaylang=en</a>.&#160;&#160; </p>
<p>Read how Scott Hanselman uses imagex.exe.&#160; <u>Great blog post!</u>&#160; <a href="http://www.hanselman.com/blog/StepByStepTurningAWindows7DVDOrISOIntoABootableVHDVirtualMachine.aspx" target="_blank">Step-By-Step: Turning a Windows 7 DVD or ISO into a Bootable VHD Virtual Machine</a></p>
<h4>Links</h4>
<p>Rather that create a new blog post with pictures, etc, I’m going to provide the links that I’ve used to be successful with VHD’s.</p>
<p>Scott Hanselman: <a href="http://www.hanselman.com/blog/StepByStepTurningAWindows7DVDOrISOIntoABootableVHDVirtualMachine.aspx" target="_blank">Step-By-Step: Turning a Windows 7 DVD or ISO into a Bootable VHD Virtual Machine</a></p>
<p>Microsoft TechNet: <a href="http://edge.technet.com/Media/Windows-7-Boot-from-VHD/" target="_blank">Windows 7 Boot from VHD</a>.&#160; This is actually the home page for a 3 part series on VHD files.&#160; Very well written and covers the scenarios I’ve listed above.&#160; </p>
<p>Microsoft Evangelist Keith Combs:&#160; </p>
<p><a href="http://edge.technet.com/Media/Dual-Boot-from-VHD-with-Windows-7-and-Windows-Sever-2008-R2/">Video:&#160; Dual Boot from VHD with Windows 7 and Windows Sever 2008 R2</a>     <br /><a href="http://blogs.technet.com/keithcombs/archive/2009/05/22/dual-boot-from-vhd-using-windows-7-and-windows-server-2008-r2.aspx" target="_blank">Article:&#160; Dual Boot from VHD Using Windows 7 and Windows Server 2008 R2</a></p>
<h4>Close</h4>
<p>I hope you find this information informative and useful.&#160; </p>
<p>Have a great day,</p>
</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Did You Know, VB.NET, Visual Studio 2010, Windows 7  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1071/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1071/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1071/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1071/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1071/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1071/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1071/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1071/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1071/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1071/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1071&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/10/09/developers-must-learn-booting-windows-7-from-a-vhd/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>XAML Power Toys v5 License Agreement Updated</title>
		<link>http://karlshifflett.wordpress.com/2009/09/21/xaml-power-toys-v5-license-agreement-updated/</link>
		<comments>http://karlshifflett.wordpress.com/2009/09/21/xaml-power-toys-v5-license-agreement-updated/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 16:33:51 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/09/21/xaml-power-toys-v5-license-agreement-updated/</guid>
		<description><![CDATA[I contacted JB Evain the author of Mono.Cecil and determined that Mono.Cecil is licensed under the MIT X11 License and not the Creative Commons license I thought it was.&#160; Many thanks to JB for clearing this up for me and for his Mono.Cecil work.&#160; 
I have updated the XAML Power Toys installer to reflect the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1055&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I contacted <a href="http://evain.net/blog/pages/perso" target="_blank">JB Evain</a> the author of Mono.Cecil and determined that Mono.Cecil is licensed under the <a href="http://www.opensource.org/licenses/mit-license.php" target="_blank">MIT X11 License</a> and not the Creative Commons license I thought it was.&#160; Many thanks to JB for clearing this up for me and for his Mono.Cecil work.&#160; </p>
<p>I have updated the XAML Power Toys installer to reflect the new license.</p>
<p>If you have downloaded XAML Power Toys already, you do not need to re-download since the MIT X11 license is even less restrictive than the Creative Commons license I thought I had to use.</p>
<p>Sorry for any confusion, this is my first license agreement I had to post.</p>
<p>The new <a href="http://www.opensource.org/licenses/mit-license.php" target="_blank">MIT X11 License</a> now reads:</p>
<p>License Agreement</p>
<p>Copyright (c) 2009 Little Richie Software</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.   </p>
<p>Have a great day,</p>
</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1055/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1055&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/09/21/xaml-power-toys-v5-license-agreement-updated/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>How to watch Sunday Night Football Full Screen with two or more Monitors</title>
		<link>http://karlshifflett.wordpress.com/2009/09/20/how-to-watch-sunday-night-football-full-screen-with-two-or-more-monitors/</link>
		<comments>http://karlshifflett.wordpress.com/2009/09/20/how-to-watch-sunday-night-football-full-screen-with-two-or-more-monitors/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 03:16:50 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[Did You Know]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/09/20/how-to-watch-sunday-night-football-full-screen-with-two-or-more-monitors/</guid>
		<description><![CDATA[If you have more than one monitor, keep reading.
When you open Sunday Night Football to view using the new Silverlight player, go full screen and then start using your other monitor to work, Silverlight immediately goes back to the smaller size.&#160; Bummer.
It’s actually a security feature, which is good.
Workaround
1.&#160; Open Sunday Night Football on your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1046&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you have more than one monitor, keep reading.</p>
<p>When you open Sunday Night Football to view using the new Silverlight player, go full screen and then start using your other monitor to work, Silverlight immediately goes back to the smaller size.&#160; Bummer.</p>
<p>It’s actually a security feature, which is good.</p>
<h4>Workaround</h4>
<p>1.&#160; Open Sunday Night Football on your second monitor.</p>
<p>2.&#160; Press CTRL + N.&#160; This will open a new browser window that you can do what you want size wise.</p>
<p>3.&#160; Close the original browser.</p>
<p>4.&#160; Now use your browser zoom feature and zoom the screen the way you want.&#160; The scrollbar allows you to position the screen as desired.</p>
<p>Have a great day,</p>
</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in Did You Know, Tips  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1046/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1046/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1046/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1046/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1046/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1046/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1046/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1046/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1046/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1046/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1046&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/09/20/how-to-watch-sunday-night-football-full-screen-with-two-or-more-monitors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
		<item>
		<title>XAML Power Toys v5 Published</title>
		<link>http://karlshifflett.wordpress.com/2009/09/20/xaml-power-toys-v5-published/</link>
		<comments>http://karlshifflett.wordpress.com/2009/09/20/xaml-power-toys-v5-published/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 02:37:01 +0000</pubDate>
		<dc:creator>Karl Shifflett</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[WPF General]]></category>
		<category><![CDATA[XAML Power Toys]]></category>

		<guid isPermaLink="false">http://karlshifflett.wordpress.com/2009/09/20/xaml-power-toys-v5-published/</guid>
		<description><![CDATA[It’s here and posted at: http://karlshifflett.wordpress.com/xaml-power-toys/
Please read the Known Issue, New Installation and Upgrading sections in the above page.
Five New 1280 x 1024 videos too. 
New Features and Changes in v5.0 

x32 and x64 support.&#160; 
Creation of Silverlight 3 DataForm from a selected class. 
ViewModel creation now allows optionally re-implementing Model properties on the ViewModel. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1044&subd=karlshifflett&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It’s here and posted at: <a href="http://karlshifflett.wordpress.com/xaml-power-toys/">http://karlshifflett.wordpress.com/xaml-power-toys/</a></p>
<p>Please read the <strong>Known Issue</strong>, <strong>New Installation</strong> and<strong> Upgrading</strong> sections in the above page.</p>
<p>Five New 1280 x 1024 videos too. </p>
<h4>New Features and Changes in v5.0 </h4>
<ul>
<li>x32 and x64 support.&#160; </li>
<li>Creation of Silverlight 3 DataForm from a selected class. </li>
<li>ViewModel creation now allows optionally re-implementing Model properties on the ViewModel. </li>
<li>Moved XAML Power Toys saved settings file out of the “\Program Files\Little Richie Software\XAML Power Toys” folder to “\Program Data\Little Richie Software\XAML Power Toys” folder. </li>
<li>Visual Studio “Add-in\Macro Security” entry no longer required. </li>
<li>Removed XAML Power Toys Solution Explorer context menus.&#160; All features are now accessed from either a code window or the XAML Editor. </li>
<li>Fixed the installer program to simply installing and uninstalling XAML Power Toys.&#160; Version 5 no longer requires any additional steps for a clean install or uninstall. </li>
<li>Completely rewrote the secondary application domain loading code from scratch. </li>
<li>Verified XAML Power Toys has no side by side issues with <a href="http://www.devexpress.com/Support/Center/p/B131164.aspx" target="_blank">DevExpress</a><font color="#0066cc"></font>.&#160; </li>
<li><span style="line-height:115%;font-family:&#39;font-size:11pt;"><font color="#000000">Added license agreement <a href="http://www.opensource.org/licenses/mit-license.html" target="_blank">MIT X11 License</a>.&#160; This was done for two reasons:</font></span>
<ul>
<li><span style="line-height:115%;font-family:&#39;font-size:11pt;"><font color="#000000">I’m now using Mono.Cecil for assembly reflection and it’s licensed using the above license.</font></span> </li>
<li><span style="line-height:115%;font-family:&#39;font-size:11pt;"><font color="#000000">Many corporate developers have a requirement that all software they install and use must have a license agreement.&#160; I’ve added it so corporate customers can now use XAML Power Toys in their organizations.</font></span> </li>
</ul>
</li>
</ul>
<p>Have a great day,</p>
</p>
<p><font color="#c0943f">Just a grain of sand on the worlds beaches.</font></p>
Posted in CodeProject, Silverlight, VB.NET, Visual Studio 2008, WPF General, XAML Power Toys  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/karlshifflett.wordpress.com/1044/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/karlshifflett.wordpress.com/1044/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/karlshifflett.wordpress.com/1044/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/karlshifflett.wordpress.com/1044/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/karlshifflett.wordpress.com/1044/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/karlshifflett.wordpress.com/1044/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/karlshifflett.wordpress.com/1044/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/karlshifflett.wordpress.com/1044/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/karlshifflett.wordpress.com/1044/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/karlshifflett.wordpress.com/1044/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=karlshifflett.wordpress.com&blog=1204518&post=1044&subd=karlshifflett&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://karlshifflett.wordpress.com/2009/09/20/xaml-power-toys-v5-published/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a76246b869fbb589804c726df582ab60?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Karl Shifflett</media:title>
		</media:content>
	</item>
	</channel>
</rss>