<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.ningzhang.org/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ning Zhang's Blog</title>
	
	<link>http://www.ningzhang.org</link>
	<description>About Silverlight, Microsoft technologies, and software development in general.</description>
	<lastBuildDate>Wed, 17 Feb 2010 22:14:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.ningzhang.org/NingZhangsBlog" /><feedburner:info uri="ningzhangsblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Silverlight Deployment Troubleshooting Guide</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/IRll9BQfebw/</link>
		<comments>http://www.ningzhang.org/2010/02/17/silverlight-deployment-troubleshooting-guide/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 21:41:29 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/02/17/silverlight-deployment-troubleshooting-guide/</guid>
		<description>After helping a few customers with Silverlight install issues, I think it may be helpful to publish a Silverlight deployment troubleshooting guide and keep it up-to-date, so here you go. 
Troubleshooting Steps

Is Silverlight installed?       on Windows, make sure “Microsoft Silverlight” is in Control Panel –&amp;#62; Programs and Features:  [...]</description>
			<content:encoded><![CDATA[<p>After helping a few customers with Silverlight install issues, I think it may be helpful to publish a Silverlight deployment troubleshooting guide and keep it up-to-date, so here you go. </p>
<h4>Troubleshooting Steps</h4>
<ul>
<li><strong>Is Silverlight installed?</strong>       <br />on Windows, make sure “Microsoft Silverlight” is in Control Panel –&gt; Programs and Features:       <br /><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image3.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="check Silverlight in appwiz.cpl" border="0" alt="check Silverlight in appwiz.cpl" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb3.png" width="584" height="262" /></a>       <br />On Mac, make sure /Library/Internet Plug-Ins/Silverlight.plugin is there. If Silverlight isn’t installed, you can install the latest version from <a href="http://www.silverlight.net">http://www.silverlight.net</a> or <a href="http://www.microsoft.com/silverlight">http://www.microsoft.com/silverlight</a>.
<ul>
<li><strong>Do you have administrative privilege on the machine?</strong>           <br />You will need local administrative privilege to install Silverlight. </li>
<li><strong>Do you have </strong><a href="http://www.webshots.com/" target="_blank"><strong>webshots</strong></a><strong>/</strong><a href="http://www.kiwee.com/" target="_blank"><strong>kiwee</strong></a><strong> toolbar installed?</strong>           <br />There are known issues with Silverlight and old version of Webshots/Kiwee from <a href="http://www.americangreetings.com/" target="_blank">American Greetings</a>. The fix is to upgrade to their latest version from their web sites. Please see <a href="http://www.ningzhang.org/2010/02/17/why-do-i-keep-getting-prompted-to-install-silverlight/" target="_blank">Why do I keep getting prompted to install Silverlight?</a> for details. </li>
</ul>
</li>
<li><strong>Is Silverlight enabled?        <br /></strong>For <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_blank">Internet Explorer</a>, select menu item Tools –&gt; Manage Add-ons, make sure Microsoft Silverlight is enabled for all web sites:       <br /><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image4.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Make sure Silverlight is enabled with IE" border="0" alt="Make sure Silverlight is enabled with IE" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb4.png" width="584" height="292" /></a> For <a href="http://www.mozilla.com/firefox" target="_blank">Firefox</a>, select menu item Tools –&gt; Add-ons, click Plugins tab, make sure Silverlight Plug-In is enabled:       <br /><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image5.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Make sure Silverlight is enabled with Firefox" border="0" alt="Make sure Silverlight is enabled with Firefox" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb5.png" width="519" height="347" /></a>       </li>
<li><strong>Is the issue site specific?</strong>       <br />try <a href="http://silverlight.net">http://silverlight.net</a>: if you see the showcase Silverlight application on the top right of the page, then your issue is likely to be site specific, please report the issue to the site owner. O/w, please click the <a href="http://forums.silverlight.net/" target="_blank">Forums</a> tab at <a href="http://silverlight.net">http://silverlight.net</a> page, search and/or report the issue there.&#160;&#160; </li>
<li><strong>Is the issue browser specific?</strong>       <br />try open the page in a different browser (IE/Firefox/Chrome on Windows, Safari/Firefox/Chrome on Mac) and see whether the issue repros. If it doesn’t repro, it is likely to be a browser specific configuration issue. Again, it may help to search <a href="http://forums.silverlight.net">http://forums.silverlight.net</a> to see whether this is a known issue; and if not, report it.       </li>
</ul>
<h4>Report Silverlight Setup Issue </h4>
<p>When you report a Silverlight setup issue, it’d help a lot if you can include the following information: </p>
<ul>
<li>a short description of the issue </li>
<li>operating system and browser you are using </li>
<li>the site you are having problem with </li>
<li>Silverlight setup log: under %temp% folder (like C:\Users\ningz\AppData\Local\Temp on Win7 or C:\Documents and Settings\ningz\Local Settings\Temp on WinXP), there are two files: a short Silverlight0.log and a longer SilverlightMSI.log). </li>
</ul>
<p>&#160;</p>
<h4>Other Helpful Sources</h4>
<ul>
<li>For Vancouver Olympics:
<ul>
<li><a title="http://www.mediaevangelism.com/olympics/faq2.aspx" href="http://www.mediaevangelism.com/olympics/faq2.aspx">http://www.mediaevangelism.com/olympics/faq2.aspx</a> </li>
<li><a title="http://www.mediaevangelism.com/olympics/faq.aspx" href="http://www.mediaevangelism.com/olympics/faq.aspx">http://www.mediaevangelism.com/olympics/faq.aspx</a> </li>
</ul>
</li>
<li><a href="http://blogs.msdn.com/rpomeroy/archive/2008/06/10/how-to-manually-clean-up-a-bad-silverlight-installation.aspx" target="_blank">How to manually clean up a broken Silverlight installation?</a> </li>
<li><a href="http://forums.silverlight.net/forums/p/151634/341581.aspx" target="_blank">Uninstalling Silverlight 4 Beta on OSX</a>       </li>
<li><a href="http://silverlight.net">http://silverlight.net</a> </li>
</ul>
<p>This is first version, I will keep adding content to the post and keep it up to date with issues I see reported. Thanks!</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8bcaea64-632d-49a5-b694-73a4b8f1c5c9" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Deployment" rel="tag">Deployment</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Deployment%20Troubleshooting%20Guide&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Deployment%20Troubleshooting%20Guide%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;title=Silverlight%20Deployment%20Troubleshooting%20Guide&amp;notes=After%20helping%20a%20few%20customers%20with%20Silverlight%20install%20issues%2C%20I%20think%20it%20may%20be%20helpful%20to%20publish%20a%20Silverlight%20deployment%20troubleshooting%20guide%20and%20keep%20it%20up-to-date%2C%20so%20here%20you%20go.%20%20%20Troubleshooting%20Steps%20%20%20%20%20Is%20Silverlight%20installed%3F%20%20%20%20%20%20%20on%20" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;title=Silverlight%20Deployment%20Troubleshooting%20Guide&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=After%20helping%20a%20few%20customers%20with%20Silverlight%20install%20issues%2C%20I%20think%20it%20may%20be%20helpful%20to%20publish%20a%20Silverlight%20deployment%20troubleshooting%20guide%20and%20keep%20it%20up-to-date%2C%20so%20here%20you%20go.%20%20%20Troubleshooting%20Steps%20%20%20%20%20Is%20Silverlight%20installed%3F%20%20%20%20%20%20%20on%20" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;t=Silverlight%20Deployment%20Troubleshooting%20Guide" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;title=Silverlight%20Deployment%20Troubleshooting%20Guide&amp;annotation=After%20helping%20a%20few%20customers%20with%20Silverlight%20install%20issues%2C%20I%20think%20it%20may%20be%20helpful%20to%20publish%20a%20Silverlight%20deployment%20troubleshooting%20guide%20and%20keep%20it%20up-to-date%2C%20so%20here%20you%20go.%20%20%20Troubleshooting%20Steps%20%20%20%20%20Is%20Silverlight%20installed%3F%20%20%20%20%20%20%20on%20" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;title=Silverlight%20Deployment%20Troubleshooting%20Guide" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F&amp;t=Silverlight%20Deployment%20Troubleshooting%20Guide" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Deployment%20Troubleshooting%20Guide&uri=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fsilverlight-deployment-troubleshooting-guide%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/IRll9BQfebw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/02/17/silverlight-deployment-troubleshooting-guide/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/02/17/silverlight-deployment-troubleshooting-guide/</feedburner:origLink></item>
		<item>
		<title>Why do I keep getting prompted to install Silverlight?</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/CoGXOyXXKQA/</link>
		<comments>http://www.ningzhang.org/2010/02/17/why-do-i-keep-getting-prompted-to-install-silverlight/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 20:06:58 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/02/17/why-do-i-keep-getting-prompted-to-install-silverlight/</guid>
		<description>Issue: a few people get prompted repeatedly to install Silverlight while visiting web sites like nbcolympics.com.
Solution: if you have old version of Webshots Toolbar or Kiwee Toolbar from American Greetings, you should upgrade to latest version from their web sites.
Details:
A few people trying to view Olympics videos from www.nbcolympics.com got prompted to install Silverlight, so [...]</description>
			<content:encoded><![CDATA[<p><strong>Issue</strong>: a few people get prompted repeatedly to install Silverlight while visiting web sites like nbcolympics.com.</p>
<p><strong>Solution</strong>: if you have old version of <a href="http://www.webshots.com/" target="_blank">Webshots</a> Toolbar or <a href="http://www.kiwee.com/" target="_blank">Kiwee</a> Toolbar from <a href="http://www.americangreetings.com/" target="_blank">American Greetings</a>, you should upgrade to latest version from their web sites.</p>
<p><strong>Details:</strong></p>
<p>A few people trying to view Olympics videos from <a href="http://www.nbcolympics.com">www.nbcolympics.com</a> got prompted to install Silverlight, so they did and then hit F5; the page somehow prompted them to install Silverlight again, so they did again; but this time Silverlight install fails with a telltale error code <a href="http://www.microsoft.com/silverlight/resources/help.aspx?errorid=1514" target="_blank">1514</a>: Silverlight is already installed; if you want to reinstall, you need to uninstall first. So they uninstall and reinstall, but that didn’t help: they got prompted to install Silverlight again. </p>
<p>After quick investigation, I’ve found a common cause of old version of Webshots or Kiwee installed on those users’ machines. To check, you can find Webshots from Control Panel –&gt; Programs and Features:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="start -&gt; run: appwiz.cpl, or control panel -&gt; add/remove programs" border="0" alt="start -&gt; run: appwiz.cpl, or control panel -&gt; add/remove programs" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb.png" width="584" height="330" /></a> </p>
<p>or on disk: </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image1.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AGI files on disk" border="0" alt="AGI files on disk" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb1.png" width="473" height="483" /></a> </p>
<p>The fix is to go to <a href="http://www.webshots.com">www.webshots.com</a> and upgrade to the latest version (3.1.5.7617 for now):</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/image2.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="http://www.webshots.com/page/apps?app=anonhomepage&amp;vhost=www" border="0" alt="http://www.webshots.com/page/apps?app=anonhomepage&amp;vhost=www" src="http://www.ningzhang.org/wp-content/uploads/2010/02/image_thumb2.png" width="548" height="484" /></a> </p>
</p>
<p>then you should be able to watch Olympics video just fine with Webshots toolbar enabled as well: </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/IESLWS.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Silverlight + WebShots in IE" border="0" alt="Silverlight + WebShots in IE" src="http://www.ningzhang.org/wp-content/uploads/2010/02/IESLWS_thumb.png" width="554" height="484" /></a> </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/02/FFSLWS.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Silverlight + WebShots in FF" border="0" alt="Silverlight + WebShots in FF" src="http://www.ningzhang.org/wp-content/uploads/2010/02/FFSLWS_thumb.png" width="583" height="484" /></a> </p>
<p>I will publish another blog post with common setup issues and solutions for Silverlight. </p>
</p>
<p><strong>Disclaimer</strong>:</p>
<ul>
<li>I am publishing this blog in a hurry to help those with trouble viewing Olympics video, so I may not get all facts right. I’d appreciate all feedback/correction/suggestion.</li>
<li>This is my personal blog. What I say in this blog is my opinion only. It doesn’t represent Microsoft or any other organization.</li>
</ul>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9d896007-c12e-4a00-8e56-d3b0dfbc34ae" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/deployment" rel="tag">deployment</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;title=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F&amp;notes=Issue%3A%20a%20few%20people%20get%20prompted%20repeatedly%20to%20install%20Silverlight%20while%20visiting%20web%20sites%20like%20nbcolympics.com.%20%20Solution%3A%20if%20you%20have%20old%20version%20of%20Webshots%20Toolbar%20or%20Kiwee%20Toolbar%20from%20American%20Greetings%2C%20you%20should%20upgrade%20to%20latest%20version%20fr" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;title=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Issue%3A%20a%20few%20people%20get%20prompted%20repeatedly%20to%20install%20Silverlight%20while%20visiting%20web%20sites%20like%20nbcolympics.com.%20%20Solution%3A%20if%20you%20have%20old%20version%20of%20Webshots%20Toolbar%20or%20Kiwee%20Toolbar%20from%20American%20Greetings%2C%20you%20should%20upgrade%20to%20latest%20version%20fr" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;t=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;title=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F&amp;annotation=Issue%3A%20a%20few%20people%20get%20prompted%20repeatedly%20to%20install%20Silverlight%20while%20visiting%20web%20sites%20like%20nbcolympics.com.%20%20Solution%3A%20if%20you%20have%20old%20version%20of%20Webshots%20Toolbar%20or%20Kiwee%20Toolbar%20from%20American%20Greetings%2C%20you%20should%20upgrade%20to%20latest%20version%20fr" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;title=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F&amp;t=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Why%20do%20I%20keep%20getting%20prompted%20to%20install%20Silverlight%3F&uri=http%3A%2F%2Fwww.ningzhang.org%2F2010%2F02%2F17%2Fwhy-do-i-keep-getting-prompted-to-install-silverlight%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/CoGXOyXXKQA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/02/17/why-do-i-keep-getting-prompted-to-install-silverlight/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/02/17/why-do-i-keep-getting-prompted-to-install-silverlight/</feedburner:origLink></item>
		<item>
		<title>Silverlight Design Time Assemblies</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/7nJ5MpxszD4/</link>
		<comments>http://www.ningzhang.org/2009/11/30/silverlight-design-time-assemblies/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 10:07:02 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Design Time]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/11/30/silverlight-design-time-assemblies/</guid>
		<description>Introduction
If you write Silverlight controls, you should consider writing design time assemblies for your controls too, for two simple reasons:

developer productivity: try to imagine Silverlight development without tools like Visual Studio or Blend! For custom controls, you may need to provide much of the design time experience for your controls in Visual Studio or Blend [...]</description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>If you write Silverlight controls, you should consider writing design time assemblies for your controls too, for two simple reasons:</p>
<ul>
<li>developer productivity: try to imagine Silverlight development without tools like Visual Studio or Blend! For custom controls, you may need to provide much of the design time experience for your controls in Visual Studio or Blend yourself. </li>
<li>designers: XAML and tools like Blend enable developers and designers work together. A key design criteria for Silverlight controls is to make sure designers can use them without writing a single line of code. </li>
</ul>
<p>Design time experience usually includes (but not limited to) the following:</p>
<ol>
<li>Metadata for property window, like category, infotip, custom property/binding/collection editors etc. </li>
<li>Metadata for design surface, like initializer, adorner, context menu, adapters etc. </li>
<li>Toolbox integration, like icons, control registration </li>
<li>intellisense for code editor </li>
</ol>
<p>Except intellisense (please see <a href="http://www.ningzhang.org/2009/04/22/add-rich-intellisense-for-your-silverlight-controls/" target="_blank">Add Rich Intellisense for Your Silverlight Controls</a>) and control registration (please see <a href="http://www.ningzhang.org/2009/04/30/register-silverlight-controls-with-visual-studio-and-blend/" target="_blank">Register Silverlight Controls with visual Studio and Blend</a>), above design time experience are usually delivered through design time assemblies. Below I will discuss various approaches of delivering design time experiences, in increasing complexity and flexibility, and gradually introduce pieces of the naming convention for design time assemblies. </p>
<h3>Runtime Assembly Only</h3>
<p>The simplest way to deliver design time experience is to package design time code into the runtime assemblies, especially when design time metadata are meaningful at runtime too, like <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverterattribute.aspx" target="_blank">TypeConverterAttribute</a>. </p>
<p>The pros and cons of this approach:</p>
<ul>
<li>Pro: simple
<ul>
<li>no separate design time assemblies, simpler setup </li>
<li>design time attributes are specified directly on the runtime code, easier to maintain </li>
</ul>
</li>
<li>Con: tight coupling of runtime and design time code
<ul>
<li>perf degradation because of useless design time code at runtime </li>
<li>design time dependencies (like MWDs and other VS/Blend assemblies) get dragged into runtime unnecessarily </li>
<li>can’t service runtime or design time independently </li>
<li>can’t support multiple designers (like both VS2008/Blend2 and VS2010/Blend3) </li>
</ul>
</li>
</ul>
<p>The cons are particularly bad for Silverlight, because design time assemblies are actually .NET assemblies, with references to Silverlight types. Mixing Silverlight and .NET assemblies can be challenging and confusing, and may lead to subtle bugs. Also, Silverlight applications are mostly web applications, so download size and performance are particularly important. Dragging in .NET assemblies in Silverlight applications certainly doesn’t help. So this approach is highly discouraged, unless there is strong justification for it.</p>
<h3>Shared Design Time Assembly</h3>
<p>So the revolutionary step forward is to decouple design time and runtime code, release and service them with separate assemblies. This opens up all kinds of possibilities. Of course, we need a way to link design time assemblies to their corresponding runtime assemblies, without introducing any unnecessary dependency or perf degradation to runtime assemblies. Hence the naming convention: <em><strong>if a runtime assembly Foo.dll is referenced in a Silverlight project, the designer </strong>(like Visual Studio and Blend)<strong> will first try to load design time information </strong>like icons (via another naming convention, see </em><a href="http://www.ningzhang.org/2009/01/21/how-to-add-an-toolbox-icon-for-your-silverlight-control/" target="_blank"><em>How to Add an Toolbox Icon for Your Silverlight Control</em></a><em>) and design time metadata (via interface, like </em><a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.metadata.iregistermetadata.aspx" target="_blank"><em>IRegisterMetadata</em></a><em> for VS2008 and Blend2, or IProvideAttributeTable for VS2010 and Blend3. Please see </em><a href="http://www.ningzhang.org/2009/03/31/how-to-write-silverlight-design-time-for-all-designers-visual-studio-2008-blend-2-blend-3-and-visual-studio-2010/" target="_blank"><em>How to Write Silverlight Design Time for All Designers: Visual Studio 2008, Blend 2; Blend 3, and Visual Studio 2010</em></a><em>) <strong>from the runtime assembly; it will then look for a design time assembly by the name Foo.Design.dll in the same directory as Foo.dll; if found, the designer will try to load design time information from Foo.Design.dll as well.</strong></em> </p>
<h3>Designer Specific Design Time Assembly</h3>
<p>Visual Studio is mostly for developers, while Blend is mostly for designers, so they have different requirements for design time experiences. Putting all design time code in one shared design time assembly introduces tight coupling among designers. So the naming convention is enhanced: <strong><em>for runtime assembly Foo.dll, there is a shared design time assembly Foo.Design.dll that’s loaded by all designers; each designer will also try to load its own design time assemblies, like Foo.VisualStudio.Design.dll for Visual Studio, and Foo.Expression.Design.dll for Blend. The designer specific design time assembly is loaded after the shared design time assembly. </em></strong>Third party designers can define their own designer specific design time assembly. <a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=19172" target="_blank">Silverlight Toolkit December 2008 Release</a> is using this naming convention. Please see <a href="http://www.ningzhang.org/2008/12/13/design-time-features-in-silverlight-toolkit/" target="_blank">Design Time Features in Silverlight Toolkit</a> and <a href="http://www.ningzhang.org/2008/12/28/design-time-feature-implementation-in-silverlight-toolkit/" target="_blank">Design Time Feature Implementation in Silverlight Toolkit</a> for more information. </p>
<h4>Design Sub Folder</h4>
<p>So to support both Visual Studio and Blend, each runtime assembly has three design time assemblies, in the same directory, and a package (like Silverlight SDK or <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>) usually contains several runtime assemblies. So the directory gets a bit crowded. A minor improvement is to put the design time assemblies under a Design subfolder. So the naming convention is further enhanced: <strong><em>if a designer (like Visual Studio or Blend) can’t find corresponding design time assemblies in the same directory as a runtime assembly, it will look for them in the Design subfolder, if it exists.</em></strong>&#160;</p>
<h3>Support Multiple Versions of MWDs</h3>
<p>Design time are built on top of <a href="http://msdn.microsoft.com/en-us/library/bb546938(VS.100).aspx" target="_blank">designer extensibility framework</a>, which consists of several dlls like Microsoft.Windows.Design.Extensibility.dll and Microsoft.Windows.Design.Interaction.dll. We usually call them collectively as MWDs. To make life more interesting, sometimes we have to introduce breaking changes to the extensibility framework, like VS2008 and Blend2 use MWD version 3.5, VS2010 and Blend3 use MWD version 4.0, and they are incompatible. So if you have a runtime assembly Foo.dll, and you want your users to be able to develop against it with both VS2008 and VS2010, you have to provide two sets of design time assemblies: one set built against v3.5 MWDs and used by VS2008, and another set built against v4.0 MWD and used by VS2010. The two sets of design time assemblies probably have a lot of code in common, while the one for VS2010 may have some new code to leverage the new functionalities exposed by VS2010. Since design time assemblies are loaded by name and you can’t have two files with the same name, so the naming convention is enhanced yet again:</p>
<p><strong><em>for a runtime assembly Foo.dll, the shared design time assembly is named Foo.Design*.dll, the Visual Studio specific design time assembly is named Foo.VisualStudio.Design*.dll, and the Blend specific design time assembly is named Foo.Expression.Design*.dll, where * can be zero or more valid characters for file names. When a designer (like Visual Studio or Blend) tries to load a design time assembly and several fit the naming convention, zero or one will be loaded:</em></strong></p>
<ul>
<li><strong><em>If the MWD version referenced by the design-time assembly has a different major version number than the designer’s MWD version, then the design-time assembly will not load and is bypassed. </em></strong></li>
<li><strong><em>If more than one design-time assembly is compatible with the designer’s MWD version, the Designer loads the one compiled against the highest MWD version that is less than or equal to the designer’s MWD version.</em></strong> </li>
</ul>
<p><a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30514" target="_blank">Silverlight 3 Toolkit October 2009 Release</a> uses this naming convention to support both VS2008 and Blend3/VS2010. Please see <a href="http://www.ningzhang.org/2009/10/21/silverlight-design-time-toolkit-october-2009-release-update/" target="_blank">Silverlight Design Time: Toolkit October 2009 Release Update</a>, <a href="http://www.ningzhang.org/2009/03/31/how-to-write-silverlight-design-time-for-all-designers-visual-studio-2008-blend-2-blend-3-and-visual-studio-2010/" target="_blank">How to Write Silverlight Design Time for All Designers: Visual Studio 2008, Blend 2; Blend 3, and Visual Studio 2010</a>, and <a href="http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/" target="_blank">Extensibility Series – WPF &amp; Silverlight Design-Time Code Sharing – Part I</a> more information. </p>
<h3>Support Both WPF and Silverlight</h3>
<p>To complicate life further, since WPF and Silverlight are so awfully similar, you may be tempted to try to write it once and run with both WPF and Silverlight. You are not alone. There are many articles on how to share source code and/or binaries across Silverlight and WPF. We’d like to do that for design time assemblies too, i.e. have the same design time assemblies for both WPF and Silverlight controls. One approach is to make most of the design time assemblies platform agnostic, and limit platform specific (WPF or Silverlight) code and references to a small platform specific assembly. <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1ea49236-0de7-41b1-81c8-a126ff39975b&amp;displaylang=en" target="_blank">Silverlight 3 SDK GDR 2</a> (installed by VS2010 automatically too) uses this approach for DataGrid designer (there is a System.Windows.Controls.Data.VisualStudio.Design.4.0.Silverlight.dll in the SDK directory). Please see <a href="http://karlshifflett.wordpress.com/2009/11/20/extensibility-series-wpf-silverlight-design-time-code-sharing-part-i/" target="_blank">Extensibility Series – WPF &amp; Silverlight Design-Time Code Sharing – Part I</a> for more information. </p>
<h3>Last One Wins</h3>
<p>The same design time metadata for a class or its member can be specified multiple times in multiple design time assemblies, which allows the shared design time assembly to specify default/common behavior and then designer specific design time assemblies to override it if necessary. The same design time metadata can also be specified multiple times within a single design time assembly (please see <a href="http://www.ningzhang.org/2008/12/28/design-time-feature-implementation-in-silverlight-toolkit/" target="_blank">Design Time Feature Implementation in Silverlight Toolkit</a> as an example, where <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.descriptionattribute.aspx" target="_blank">DescriptionAttribute</a> for a class or its property can be added by AddDescriptions, AddAttributes and AddTables methods). So we need to know which metadata wins. The simplest and most logic design is <strong>last one wins</strong>. This is mostly true but not always. Sometimes the result can be un-deterministic when the same design time metadata is specified several times but with different values. </p>
<h3>Feedback</h3>
<p>Design time sounds easy, but devil is in the details! Feedbacks are always appreciated. Please let me know what issues you run into, what requests/improvements you’d like to make, for both design times experience and designer extensibility framework. Thanks!</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7610ba0f-16e0-4a96-8b2b-8cf4dface553" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Design+Time" rel="tag">Design Time</a>,<a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>,<a href="http://technorati.com/tags/Visual+Studio" rel="tag">Visual Studio</a>,<a href="http://technorati.com/tags/Blend" rel="tag">Blend</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Design%20Time%20Assemblies&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Design%20Time%20Assemblies%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;title=Silverlight%20Design%20Time%20Assemblies&amp;notes=Introduction%20%20If%20you%20write%20Silverlight%20controls%2C%20you%20should%20consider%20writing%20design%20time%20assemblies%20for%20your%20controls%20too%2C%20for%20two%20simple%20reasons%3A%20%20%20%20%20developer%20productivity%3A%20try%20to%20imagine%20Silverlight%20development%20without%20tools%20like%20Visual%20Studio%20or%20" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;title=Silverlight%20Design%20Time%20Assemblies&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Introduction%20%20If%20you%20write%20Silverlight%20controls%2C%20you%20should%20consider%20writing%20design%20time%20assemblies%20for%20your%20controls%20too%2C%20for%20two%20simple%20reasons%3A%20%20%20%20%20developer%20productivity%3A%20try%20to%20imagine%20Silverlight%20development%20without%20tools%20like%20Visual%20Studio%20or%20" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;t=Silverlight%20Design%20Time%20Assemblies" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;title=Silverlight%20Design%20Time%20Assemblies&amp;annotation=Introduction%20%20If%20you%20write%20Silverlight%20controls%2C%20you%20should%20consider%20writing%20design%20time%20assemblies%20for%20your%20controls%20too%2C%20for%20two%20simple%20reasons%3A%20%20%20%20%20developer%20productivity%3A%20try%20to%20imagine%20Silverlight%20development%20without%20tools%20like%20Visual%20Studio%20or%20" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;title=Silverlight%20Design%20Time%20Assemblies" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F&amp;t=Silverlight%20Design%20Time%20Assemblies" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Design%20Time%20Assemblies&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F30%2Fsilverlight-design-time-assemblies%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/7nJ5MpxszD4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/11/30/silverlight-design-time-assemblies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/11/30/silverlight-design-time-assemblies/</feedburner:origLink></item>
		<item>
		<title>Silverlight Drag and Drop API</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/98Ap0JPQJ-A/</link>
		<comments>http://www.ningzhang.org/2009/11/28/silverlight-drag-and-drop-api/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 10:08:42 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Drag and Drop]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/11/28/silverlight-drag-and-drop-api/</guid>
		<description>Introduction
Drag and drop is a common UX paradigm and a top requested feature. In Silverlight 4 Beta, we introduced a basic set of API to enable the most common scenario of dragging pictures files and dropping them to Silverlight applications, and we designed the API to allow us to expose more drag and drop functionalities [...]</description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Drag and drop is a common UX paradigm and a top requested feature. In Silverlight 4 Beta, we introduced a basic set of API to enable the most common scenario of dragging pictures files and dropping them to Silverlight applications, and we designed the API to allow us to expose more drag and drop functionalities down the road without API change, hopefully. </p>
<h3>API</h3>
<p>Below is the core of the new API:</p>
<p>   <div id="codeSnippetWrapper" class="csharpcode-wrapper">   <pre id="codeSnippet" class="csharpcode"><span class="kwrd">namespace</span> System.Windows<br />{<br />    <span class="kwrd">public</span> <span class="kwrd">abstract</span> <span class="kwrd">class</span> UIElement : DependencyObject<br />    {<br />        <span class="rem">// Fields</span><br />        <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">readonly</span> DependencyProperty AllowDropProperty;<br /><br />        <span class="rem">// Events</span><br />        <span class="kwrd">public</span> <span class="kwrd">event</span> DragEventHandler DragEnter;<br />        <span class="kwrd">public</span> <span class="kwrd">event</span> DragEventHandler DragLeave;<br />        <span class="kwrd">public</span> <span class="kwrd">event</span> DragEventHandler DragOver;<br />        <span class="kwrd">public</span> <span class="kwrd">event</span> DragEventHandler Drop;<br /><br />        <span class="rem">// Properties</span><br />        <span class="kwrd">public</span> <span class="kwrd">bool</span> AllowDrop { get; set; }<br />    }<br /><br />    <span class="kwrd">public</span> <span class="kwrd">delegate</span> <span class="kwrd">void</span> DragEventHandler(<span class="kwrd">object</span> sender, DragEventArgs e);<br /><br />    <span class="kwrd">public</span> <span class="kwrd">sealed</span> <span class="kwrd">class</span> DragEventArgs : RoutedEventArgs<br />    {<br />        <span class="rem">// Methods</span><br />        <span class="kwrd">public</span> Point GetPosition(UIElement relativeTo);<br /><br />        <span class="rem">// Properties</span><br />        <span class="kwrd">public</span> IDataObject Data { [SecuritySafeCritical] get; }<br />        <span class="kwrd">public</span> <span class="kwrd">bool</span> Handled { get; set; }<br />    }<br />}<br /><br /><span class="kwrd">namespace</span> System.Windows.Controls<br />{<br />    <span class="kwrd">public</span> <span class="kwrd">abstract</span> <span class="kwrd">class</span> Control : FrameworkElement<br />    {<br />        <span class="kwrd">protected</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> OnDragEnter(DragEventArgs e);<br />        <span class="kwrd">protected</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> OnDragLeave(DragEventArgs e);<br />        <span class="kwrd">protected</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> OnDragOver(DragEventArgs e);<br />        <span class="kwrd">protected</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> OnDrop(DragEventArgs e);<br />    }<br />}</pre>

  <br /></div>
</p>
<ul>
<li>AllowDrop: this is dependency property, indicating whether an element is a drop target. </li>
<li>DragEnter, DragLeave, DragOver &amp; Drop: these are routed events. They bubble up, and fire only on elements with AllowDrop set to true. </li>
<li>OnDragEnter, OnDragLeave, OnDragOver &amp; OnDrop: these are protected virtual functions for subclasses to override.&#160; </li>
<li>DragEventArgs: this class allows drop target event handlers or method overrides to access the data being dragged or dropped. </li>
</ul>
<h3>Usage</h3>
<p>There are primarily two ways to use Silverlight’s drag and drop API:</p>
<ul>
<li>Silverlight applications can handle those drop target events and process the files dropped in the event handlers. </li>
<li>Silverlight controls can override those drop target virtual functions to process the data being dragged and dropped, and enable themselves to be drop targets. </li>
</ul>
<h3>Limitations</h3>
<p>The drag and drop functionality shipped in Silverlight 4 Beta only enables the most common scenario: Silverlight plugin as a file drop target. Please notice the following limitations with current implementation:</p>
<ul>
<li>there is no drop source support (QueryContinueDrag &amp; GiveFeedback). </li>
<li>there is no DragDropEffects or DragDropKeyStates in DragEventArgs. </li>
<li>there is no visual for the dragged object or DragDropEffects. </li>
<li>only file drag and drop is supported:
<ul>
<li>all drop target events fire only when files are being dragged and dropped. </li>
<li>IDataObject, DataObject and DragEventArgs.Data support only one format: “FileDrop”, and the data is of type FileInfo[]. </li>
</ul>
</li>
<li>most of IDataObject methods throw NotImplementedException.<br />
    </li>
<li>for drag and drop to work on Windows, Silverlight plugin must be windowed. In another word, if &lt;param name=&quot;windowless&quot; value=&quot;true&quot;/&gt; is specified, drop events won’t fire. </li>
<li>since Silverlight plugin on Mac is always windowless, you need to hook up JavaScript drop events to trigger Silverlight drop events. In another word, if you want your Silverlight application to support file drop on Mac as well as Windows, you will need to add following script and Silverlight plugin attributes to the hosting html or aspx page: 
    <div id="codeSnippetWrapper" class="csharpcode-wrapper">
      <pre id="codeSnippet" class="csharpcode">&lt;!-- add following script before end of HEAD tag --&gt;<br />&lt;script type=<span class="str">&quot;text/javascript&quot;</span>&gt;<br />    <span class="kwrd">function</span> handleDragEnter(oEvent) {<br />        <span class="rem">// Prevent default operations</span><br />        oEvent.preventDefault();<br /><br />        <span class="kwrd">var</span> flag = silverlightControl.dragEnter(oEvent);<br /><br />        <span class="rem">// If we handled it successfully then stop propagation of the event</span><br />        <span class="kwrd">if</span> (flag)<br />            oEvent.stopPropagation();<br />    }<br /><br />    <span class="kwrd">function</span> handleDragLeave(oEvent) {<br />        <span class="rem">// Prevent default operations</span><br />        oEvent.preventDefault();<br /><br />        <span class="kwrd">var</span> flag = silverlightControl.dragLeave(oEvent);<br /><br />        <span class="rem">// If we handled it successfully then stop propagation of the event</span><br />        <span class="kwrd">if</span> (flag)<br />            oEvent.stopPropagation();<br />    }<br /><br />    <span class="kwrd">function</span> handleDragOver(oEvent) {<br />        <span class="rem">// Prevent default operations</span><br />        oEvent.preventDefault();<br /><br />        <span class="kwrd">var</span> flag = silverlightControl.dragOver(oEvent);<br /><br />        <span class="rem">// If we handled it successfully then stop propagation of the event</span><br />        <span class="kwrd">if</span> (flag)<br />            oEvent.stopPropagation();<br />    }<br /><br />    <span class="kwrd">function</span> handleDropEvent(oEvent) {<br /><br />        <span class="rem">// Prevent default operations</span><br />        oEvent.preventDefault();<br /><br />        <span class="kwrd">var</span> flag = silverlightControl.dragDrop(oEvent);<br /><br />        <span class="rem">// If we handled it successfully then stop propagation of the event</span><br />        <span class="kwrd">if</span> (flag)<br />            oEvent.stopPropagation();<br />    }<br />&lt;/script&gt;<br />&lt;!-- use JavaScript drop target events to trigger Silverlight's drop target events --&gt;<br />&lt;<span class="kwrd">object</span> data=<span class="str">&quot;data:application/x-silverlight-2,&quot;</span> type=<span class="str">&quot;application/x-silverlight-2&quot;</span> width=<span class="str">&quot;100%&quot;</span> height=<span class="str">&quot;100%&quot;</span><br />  id=<span class="str">&quot;silverlightControl&quot;</span> ondragenter=<span class="str">&quot;handleDragEnter(event)&quot;</span> ondragover=<span class="str">&quot;handleDragOver(event)&quot;</span> <br />  ondragleave=<span class="str">&quot;handleDragLeave(event)&quot;</span> ondrop=<span class="str">&quot;handleDropEvent(event)&quot;</span> &gt;<br /></pre>

      <br /></div>

<p></li>
<li>DragEventArgs.Data is only accessible in Drop event. Accessing DragEventArgs.Data in DragEnter, DragOver and DragLeave may cause <a href="http://msdn.microsoft.com/en-us/library/system.security.securityexception(VS.95).aspx" target="_blank">SecurityException</a>. And accessing Directory, DirectoryName or FullName property of the FileInfo object from DragEventArgs.Data may cause ArgumentNullException.&#160; </li>
</ul>
<ul>
<h3>Demo App</h3>
<p>Below is a demo app:</ul>
<ul>
<li>the top left nested grids use drop target event handler to display DragEventArgs info. </li>
<li>the top right nested grids contain an ImageDropTarget user control, which overrides OnDrop method to render the dropped file if it is an image. </li>
<li>the bottom listbox shows the sequence of drop target events, their bubbling up, and DragEventArgs info. </li>
</ul>
<ol></ol>
<p><a title="DragDropDemon" href="http://www.ningzhang.org/wp-content/uploads/DragDropDemo/DragDropDemo.Web/DragDropDemoTestPage.html" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Click to run DragDropDemo if you have Silverlight 4 Beta installed." border="0" alt="Click to run DragDropDemo if you have Silverlight 4 Beta installed." src="http://www.ningzhang.org/wp-content/uploads/2009/11/image1.png" width="584" height="444" /></a> </p>
<p>you can find the complete source <a href="http://www.ningzhang.org/wp-content/uploads/DragDropDemo.zip" target="_blank">here</a>. </p>
<h3>Feedback</h3>
<p>While we are excited to add drag and drop to Silverlight, we know there are a lot to finish/improve, and what we released is just a Beta. As always, your feedback is highly appreciated, and will be used as an important data point to help us prioritize the work. Thanks!</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ee3fd3e3-f006-4317-9edc-ac5b07aaf491" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Drag+and+Drop" rel="tag">Drag and Drop</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Drag%20and%20Drop%20API&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Drag%20and%20Drop%20API%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;title=Silverlight%20Drag%20and%20Drop%20API&amp;notes=Introduction%20%20Drag%20and%20drop%20is%20a%20common%20UX%20paradigm%20and%20a%20top%20requested%20feature.%20In%20Silverlight%204%20Beta%2C%20we%20introduced%20a%20basic%20set%20of%20API%20to%20enable%20the%20most%20common%20scenario%20of%20dragging%20pictures%20files%20and%20dropping%20them%20to%20Silverlight%20applications%2C%20and%20" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;title=Silverlight%20Drag%20and%20Drop%20API&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Introduction%20%20Drag%20and%20drop%20is%20a%20common%20UX%20paradigm%20and%20a%20top%20requested%20feature.%20In%20Silverlight%204%20Beta%2C%20we%20introduced%20a%20basic%20set%20of%20API%20to%20enable%20the%20most%20common%20scenario%20of%20dragging%20pictures%20files%20and%20dropping%20them%20to%20Silverlight%20applications%2C%20and%20" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;t=Silverlight%20Drag%20and%20Drop%20API" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;title=Silverlight%20Drag%20and%20Drop%20API&amp;annotation=Introduction%20%20Drag%20and%20drop%20is%20a%20common%20UX%20paradigm%20and%20a%20top%20requested%20feature.%20In%20Silverlight%204%20Beta%2C%20we%20introduced%20a%20basic%20set%20of%20API%20to%20enable%20the%20most%20common%20scenario%20of%20dragging%20pictures%20files%20and%20dropping%20them%20to%20Silverlight%20applications%2C%20and%20" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;title=Silverlight%20Drag%20and%20Drop%20API" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F&amp;t=Silverlight%20Drag%20and%20Drop%20API" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Drag%20and%20Drop%20API&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F28%2Fsilverlight-drag-and-drop-api%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/98Ap0JPQJ-A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/11/28/silverlight-drag-and-drop-api/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/11/28/silverlight-drag-and-drop-api/</feedburner:origLink></item>
		<item>
		<title>Silverlight 4 Adds Arabic Support</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/4KXnFewjqNY/</link>
		<comments>http://www.ningzhang.org/2009/11/18/silverlight-4-adds-arabic-support/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 20:07:00 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Arabic]]></category>
		<category><![CDATA[FlowDirection]]></category>
		<category><![CDATA[RTL]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/?p=511</guid>
		<description>Silverlight 4 adds support for Arabic culture:

Install, configuration and runtime UI are in Arabic and RTL layout on Arabic culture 
Support mixed BiDi/ComplexScript text 
Support RTL layout with FlowDirection attribute and implemented by all controls 

Below screenshots demonstrate some of the support: 

Install UI:       
Configuration UI:    [...]</description>
			<content:encoded><![CDATA[<p>Silverlight 4 adds support for Arabic culture:</p>
<ul>
<li>Install, configuration and runtime UI are in Arabic and RTL layout on Arabic culture </li>
<li>Support mixed BiDi/ComplexScript text </li>
<li>Support RTL layout with <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.flowdirection.aspx" target="_blank">FlowDirection</a> attribute and implemented by all controls </li>
</ul>
<p>Below screenshots demonstrate some of the support: </p>
<ul>
<li>Install UI:      <br /><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Silverlight developer runtime install UI" border="0" alt="Silverlight developer runtime install UI" src="http://www.ningzhang.org/wp-content/uploads/2009/10/sl4install2.jpg" width="513" height="240" /> </li>
<li>Configuration UI:      <br /><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Silverlight Configuration UI" border="0" alt="Silverlight Configuration UI" src="http://www.ningzhang.org/wp-content/uploads/2009/10/configabout.jpg" width="578" height="400" /> </li>
<li>Controls with FlowDirection set to RightToLeft:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/controlsrtl2.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="RTL Layout and Controls Demo" border="0" alt="RTL Layout and Controls Demo" src="http://www.ningzhang.org/wp-content/uploads/2009/10/controlsrtl2_thumb.jpg" width="584" height="588" /></a> </li>
</ul>
<p>For those curious, you may notice that:</p>
<ul>
<li>there is a new <font face="System">ar</font> directory under <font face="system">%programfiles%\Microsoft Silverlight\4.0.41108.0</font>, besides the 10 directories that have been there since SL3: <font face="System">de, en-us, es, fr, it, ja, ko, zh-Hans, zh-Hint</font>. The <strong>ar</strong> directory contains Arabic resources for Silverlight runtime assemblies. </li>
<li>the MUI resource dlls contain Arabic resources:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/image.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2009/10/image_thumb.png" width="584" height="348" /></a> </li>
</ul>
<p>We will continue adding more support to more cultures in Silverlight. The Arabic support debuted in Silverlight 4 Beta is particularly important, since it is the first RTL language Silverlight supports. If you notice any bug or have suggestions, please let me know. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:131f9e58-e7cf-4dcc-ad04-001a28b64785" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Arabic" rel="tag">Arabic</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%204%20Adds%20Arabic%20Support&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%204%20Adds%20Arabic%20Support%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;title=Silverlight%204%20Adds%20Arabic%20Support&amp;notes=Silverlight%204%20adds%20support%20for%20Arabic%20culture%3A%20%20%20%20%20Install%2C%20configuration%20and%20runtime%20UI%20are%20in%20Arabic%20and%20RTL%20layout%20on%20Arabic%20culture%20%20%20%20%20Support%20mixed%20BiDi%2FComplexScript%20text%20%20%20%20%20Support%20RTL%20layout%20with%20FlowDirection%20attribute%20and%20implemented%20by%20a" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;title=Silverlight%204%20Adds%20Arabic%20Support&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Silverlight%204%20adds%20support%20for%20Arabic%20culture%3A%20%20%20%20%20Install%2C%20configuration%20and%20runtime%20UI%20are%20in%20Arabic%20and%20RTL%20layout%20on%20Arabic%20culture%20%20%20%20%20Support%20mixed%20BiDi%2FComplexScript%20text%20%20%20%20%20Support%20RTL%20layout%20with%20FlowDirection%20attribute%20and%20implemented%20by%20a" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;t=Silverlight%204%20Adds%20Arabic%20Support" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;title=Silverlight%204%20Adds%20Arabic%20Support&amp;annotation=Silverlight%204%20adds%20support%20for%20Arabic%20culture%3A%20%20%20%20%20Install%2C%20configuration%20and%20runtime%20UI%20are%20in%20Arabic%20and%20RTL%20layout%20on%20Arabic%20culture%20%20%20%20%20Support%20mixed%20BiDi%2FComplexScript%20text%20%20%20%20%20Support%20RTL%20layout%20with%20FlowDirection%20attribute%20and%20implemented%20by%20a" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;title=Silverlight%204%20Adds%20Arabic%20Support" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F&amp;t=Silverlight%204%20Adds%20Arabic%20Support" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%204%20Adds%20Arabic%20Support&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-4-adds-arabic-support%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/4KXnFewjqNY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/11/18/silverlight-4-adds-arabic-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/11/18/silverlight-4-adds-arabic-support/</feedburner:origLink></item>
		<item>
		<title>Silverlight Clipboard API</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/XGKzU2ZTpZw/</link>
		<comments>http://www.ningzhang.org/2009/11/18/silverlight-clipboard-api/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 19:34:00 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/11/18/silverlight-clipboard-api/</guid>
		<description>Clipboard API in Silverlight
Silverlight 4 adds Clipboard support. Check out the amazing demos by Scott Guthrie and Brian Goldfarb today at PDC that showcase scenarios enabled by Silveilght4 Clipboard support.
Silverlight’s Clipboard API is a subset of WPF’s Clipboard API:
      public static class Clipboard {     public static [...]</description>
			<content:encoded><![CDATA[<h3>Clipboard API in Silverlight</h3>
<p>Silverlight 4 adds Clipboard support. Check out the amazing demos by Scott Guthrie and Brian Goldfarb today at <a href="http://microsoftpdc.com/" target="_blank">PDC</a> that showcase scenarios enabled by Silveilght4 Clipboard support.</p>
<p>Silverlight’s Clipboard API is a subset of WPF’s <a href="http://msdn.microsoft.com/en-us/library/system.windows.clipboard.aspx" target="_blank">Clipboard</a> API:</p>
<p>   <div id="codeSnippetWrapper" class="csharpcode-wrapper">   <pre id="codeSnippet" class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">class</span> Clipboard <br />{ <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsText(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetText(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetText(<span class="kwrd">string</span> text); <br />}</pre>

  <br /></div>
</p>
<p>It allows copy/paste Unicode strings to/from system clipboard. GetText and SetText require either of following to succeed: </p>
<ol>
<li>the calling Silverlight application is an elevated trust application, or </li>
<li>it is user initiated and user grants clipboard access </li>
</ol>
<p>For the second case, when GetText or SetText is first called in an user initiated event handling, Silverlight pops up a dialog like the one below (UI may change at RTW):</p>
<ul><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Clipboard Prompt" border="0" alt="Clipboard Prompt" src="http://www.ningzhang.org/wp-content/uploads/2009/11/clipboardprompt.png" width="498" height="203" /> </ul>
<ul>If user clicks yes, Silverlight will allow this and later GetText/SetText calls to succeed for this application during this session; if user clicks no, the default, Silverlight will throw a <a href="http://msdn.microsoft.com/en-us/library/system.security.securityexception(VS.95).aspx" target="_blank">SecurityException</a>. In another word, the setting is per application, per session, for both get and set access to system clipboard, and it is not persisted. </ul>
<h3>Clipboard API in JavaScript and WPF</h3>
<p>We need to consider many factors while designing Clipboard API for Silverlight. Among them, the Clipboard APIs of JavaScript and WPF are particularly interesting, because we need to study the security lessons in JavaScript and try to be compatible with WPF.</p>
<p>There is no cross browser, cross platform JavaScript API for clipboard access. IE provides <a href="http://msdn.microsoft.com/en-us/library/ms535220(VS.85).aspx" target="_blank">clipboardData</a> object that allows get/set/clear strings in system clipboard:</p>
<blockquote>
<p>bResult = window.clipboardData.setData(sDataFormat, sData);<br />
    <br />sData = window.clipboardData.getData(sDataFormat); </p>
<p>bResult = window.clipboardData.clearData([sDataFormat]);</p>
<p>where sDataFormat is a string constant of &quot;Text&quot; or &quot;URL&quot;, sData is a string, and bResult is a Boolean.</p>
</blockquote>
<p>The first time the clipboadData object is accessed, IE will prompt user to allow the script to access clipboard, and the setting is valid for the session only.</p>
<p>WPF’s Clipboard API supports more and extensible data format via <a href="http://msdn.microsoft.com/en-us/library/system.windows.idataobject.aspx" target="_blank">IDataObject</a>, and has helper functions for common formats like text, image, audio, and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.dataformats.filedrop.aspx" target="_blank">filedrop</a>.</p>
<p>

<div id="codeSnippetWrapper" class="csharpcode-wrapper">
  <pre id="codeSnippet" class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">class</span> Clipboard <br />{ <br />    [SecurityCritical] <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> Clear(); <br /><br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsAudio(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsData(<span class="kwrd">string</span> format); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsFileDropList(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsImage(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsText(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> ContainsText(TextDataFormat format); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> Stream GetAudioStream(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">object</span> GetData(<span class="kwrd">string</span> format); <br />    [SecurityCritical] <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> IDataObject GetDataObject(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> StringCollection GetFileDropList(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> BitmapSource GetImage(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetText(); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetText(TextDataFormat format); <br /><br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">bool</span> IsCurrent(IDataObject data); <br /><br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetAudio(<span class="kwrd">byte</span>[] audioBytes); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetAudio(Stream audioStream); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetData(<span class="kwrd">string</span> format, <span class="kwrd">object</span> data); <br />    [SecurityCritical] <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetDataObject(<span class="kwrd">object</span> data); <br />    [SecurityCritical] <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetDataObject(<span class="kwrd">object</span> data, <span class="kwrd">bool</span> copy); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetFileDropList(StringCollection fileDropList); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetImage(BitmapSource image); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetText(<span class="kwrd">string</span> text); <br />    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetText(<span class="kwrd">string</span> text, TextDataFormat format); <br />}</pre>

  <br /></div>
</p>
<h3>Clipboard API in Windows and Mac OS X</h3>
<p>Silverlight’s clipboard API is ultimately implemented on top of the clipboard APIs of the underlying operating system. <a href="http://msdn.microsoft.com/en-us/library/ms648709(VS.85).aspx" target="_blank">Windows’ clipboard APIs</a> are documented at MSDN, below excerpt gives an overview on how to set/get clipboard data:</p>
<blockquote>
<h4>Cut and Copy Operations</h4>
<p>To place information on the clipboard, a window first clears any previous clipboard content by using the <a href="http://msdn.microsoft.com/en-us/library/ms649037(VS.85).aspx">EmptyClipboard</a> function. This function sends the <a href="http://msdn.microsoft.com/en-us/library/ms649024(VS.85).aspx">WM_DESTROYCLIPBOARD</a> message to the previous clipboard owner, frees resources associated with data on the clipboard, and assigns clipboard ownership to the window that has the clipboard open. To find out which window owns the clipboard, call the <a href="http://msdn.microsoft.com/en-us/library/ms649041(VS.85).aspx">GetClipboardOwner</a> function.</p>
<p>After emptying the clipboard, the window places data on the clipboard in as many clipboard formats as possible, ordered from the most descriptive clipboard format to the least descriptive. For each format, the window calls the <a href="http://msdn.microsoft.com/en-us/library/ms649051(VS.85).aspx">SetClipboardData</a> function, specifying the format identifier and a global memory handle. The memory handle can be NULL, indicating that the window renders the data on request. For more information, see <a href="http://msdn.microsoft.com/#_win32_Delayed_Rendering">Delayed Rendering</a>.</p>
<h4><a></a>Paste Operations</h4>
<p>To retrieve paste information from the clipboard, a window first determines the clipboard format to retrieve. Typically, a window enumerates the available clipboard formats by using the <a href="http://msdn.microsoft.com/en-us/library/ms649038(VS.85).aspx">EnumClipboardFormats</a> function and uses the first format it recognizes. This method selects the best available format according to the priority set when the data was placed on the clipboard.</p>
<p>Alternatively, a window can use the <a href="http://msdn.microsoft.com/en-us/library/ms649045(VS.85).aspx">GetPriorityClipboardFormat</a> function. This function identifies the best available clipboard format according to a specified priority. A window that recognizes only one clipboard format can simply determine whether that format is available by using the <a href="http://msdn.microsoft.com/en-us/library/ms649047(VS.85).aspx">IsClipboardFormatAvailable</a> function.</p>
<p>After determining the clipboard format to use, a window calls the <a href="http://msdn.microsoft.com/en-us/library/ms649039(VS.85).aspx">GetClipboardData</a> function. This function returns the handle to a global memory object containing data in the specified format. A window can briefly lock the memory object in order to examine or copy the data. However, a window should not free the object or leave it locked for a long period of time.</p>
</blockquote>
<p>For now, Silverlight Clipboard API only supports <a href="http://msdn.microsoft.com/en-us/library/ms649013(VS.85).aspx" target="_blank">CF_UNICODETEXT</a> format for copy/paste Unicode text to/from clipboard.</p>
<p>Mac OS X uses <a href="http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/Pasteboard_Prog_Guide/paste_intro/paste_intro.html" target="_blank">Pasteboard Manager</a>. It is documented at <a href="http://developer.apple.com/" target="_blank">Mac Dev Center</a>. Below excerpt (with APIs added) gives an overview:</p>
<blockquote>
<p>The copying application is responsible for placing copied or cut data onto the pasteboard:</p>
<ol>
<li>
<p>The user selects some data and invokes the Copy (or Cut) menu item.</p>
</li>
<li>
<p>If the application doesn’t already have a reference to the Clipboard pasteboard, it creates one (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardCreate" target="_blank">PasteboardCreate</a>).</p>
</li>
<li>
<p>The application then takes ownership of the pasteboard and clears the current contents (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardClear" target="_blank">PasteboardClear</a>).</p>
</li>
<li>
<p>The application assigns item IDs to the selected data.</p>
</li>
<li>
<p>If any data is to be promised, the application must register a promise keeper callback function to supply the promised data (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardSetPromiseKeeper" target="_blank">PasteboardSetPromiseKeeper</a>).</p>
</li>
<li>
<p>The application adds one or more flavors of each item to the pasteboard, including either the actual flavor data or a promise with each flavor (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardPutItemFlavor" target="_blank">PasteboardPutItemFlavor</a>).</p>
</li>
</ol>
<p>The receiving application has a slightly different set of tasks to handle the Paste action:</p>
<ol>
<li>
<p>When the application becomes active, it checks to see if the pasteboard has been modified (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardSynchronize" target="_blank">PasteboardSynchronize</a>). If so, it obtains a listing of the flavors on the pasteboard. If there are any flavors the application supports, it can enable its Paste menu item.</p>
</li>
<li>
<p>The user invokes the Paste menu item.</p>
</li>
<li>
<p>The application requests the item (or items) on the pasteboard in the flavors that it supports (<a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardGetItemCount" target="_blank">PasteboardGetItemCount</a>, <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardGetItemIdentifier" target="_blank">PasteboardGetItemIdentifier</a>, <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardCopyItemFlavors" target="_blank">PasteboardCopyItemFlavors</a>, <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#//apple_ref/c/func/PasteboardCopyItemFlavorData" target="_blank">PasteboardCopyItemFlavorData</a>).</p>
</li>
<li>
<p>If the pasted data is to be stored as a file, the receiving application needs to set a paste location before requesting any flavor data. In any other case, the receiving application doesn’t need to worry about whether the paste data was promised or not.</p>
</li>
</ol>
<p>If the copying application’s promise keeper is called, the callback must do the following:</p>
<ul>
<li>
<p>If the data is to be stored as a file, determine the paste location specified by the receiving application.</p>
</li>
<li>
<p>Generate or otherwise prepare the promised data for transfer.</p>
</li>
<li>
<p>If the promised data is not be stored as a file, add the flavor and data to the pasteboard. Otherwise, transfer the promised data to the specified file location.</p>
</li>
</ul>
<p>Some time later, when the application quits, or when it no longer needs the pasteboard, the application can release the pasteboard reference.</p>
</blockquote>
<p>As on Windows, Silverlight Clipboard API only uses <a href="http://developer.apple.com/mac/library/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html#jumpTo_23" target="_blank">kPasteboardClipboard</a> and <a href="http://developer.apple.com/mac/library/documentation/FileManagement/Conceptual/understanding_utis/utilist/UTIlist.html" target="_blank">kUTTypeUTF16PlainText</a> flavor to support copy/paste Unicode text to/from clipboard.</p>
<h3>Feedback</h3>
<p>We are excited to add clipboard support to Silverlight, and see all the important scenarios enabled by this simple API. I am interested in hearing your feedbacks, especially:</p>
<ul>
<li>any security concerns over Silverlight clipboard API design and implementation </li>
<li>how important it is to add support for other data type/format, and in what priority order </li>
<li>how important it is to make the API extensible, like supporting <a href="http://msdn.microsoft.com/en-us/library/system.windows.idataobject.aspx" target="_blank">IDataObject</a>, allowing custom format/flavor and delayed rendering/promised data </li>
</ul>
<ul>Thanks!</ul>
<ul></ul>
<ul>-Ning</ul>
<ul></ul>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d028d2cf-c923-4643-81fb-51b31d05fbff" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Clipboard" rel="tag">Clipboard</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Clipboard%20API&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Clipboard%20API%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;title=Silverlight%20Clipboard%20API&amp;notes=Clipboard%20API%20in%20Silverlight%20%20Silverlight%204%20adds%20Clipboard%20support.%20Check%20out%20the%20amazing%20demos%20by%20Scott%20Guthrie%20and%20Brian%20Goldfarb%20today%20at%20PDC%20that%20showcase%20scenarios%20enabled%20by%20Silveilght4%20Clipboard%20support.%20%20Silverlight%E2%80%99s%20Clipboard%20API%20is%20a%20sub" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;title=Silverlight%20Clipboard%20API&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Clipboard%20API%20in%20Silverlight%20%20Silverlight%204%20adds%20Clipboard%20support.%20Check%20out%20the%20amazing%20demos%20by%20Scott%20Guthrie%20and%20Brian%20Goldfarb%20today%20at%20PDC%20that%20showcase%20scenarios%20enabled%20by%20Silveilght4%20Clipboard%20support.%20%20Silverlight%E2%80%99s%20Clipboard%20API%20is%20a%20sub" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;t=Silverlight%20Clipboard%20API" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;title=Silverlight%20Clipboard%20API&amp;annotation=Clipboard%20API%20in%20Silverlight%20%20Silverlight%204%20adds%20Clipboard%20support.%20Check%20out%20the%20amazing%20demos%20by%20Scott%20Guthrie%20and%20Brian%20Goldfarb%20today%20at%20PDC%20that%20showcase%20scenarios%20enabled%20by%20Silveilght4%20Clipboard%20support.%20%20Silverlight%E2%80%99s%20Clipboard%20API%20is%20a%20sub" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;title=Silverlight%20Clipboard%20API" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F&amp;t=Silverlight%20Clipboard%20API" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Clipboard%20API&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F11%2F18%2Fsilverlight-clipboard-api%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/XGKzU2ZTpZw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/11/18/silverlight-clipboard-api/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/11/18/silverlight-clipboard-api/</feedburner:origLink></item>
		<item>
		<title>Silverlight Design Time: Toolkit October 2009 Release Update</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/da2jr16qkxQ/</link>
		<comments>http://www.ningzhang.org/2009/10/21/silverlight-design-time-toolkit-october-2009-release-update/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 01:18:20 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Design Time]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/10/21/silverlight-design-time-toolkit-october-2009-release-update/</guid>
		<description>Overview
Visual Studio 2010 Beta 2 is available now. For Silverlight developers, the most exciting news about VS2010 is that Silverlight designer will be in feature parity with WPF designer, and VS2010 will support multi-targeting for Silverlight development. Silverlight Toolkit team has been working closely with Cider team in providing the design time experience for Silverlight [...]</description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p><a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank">Visual Studio 2010 Beta 2</a> is available now. For Silverlight developers, the most exciting news about VS2010 is that Silverlight designer will be in feature parity with WPF designer, and VS2010 will support multi-targeting for Silverlight development. Silverlight Toolkit team has been working closely with Cider team in providing the design time experience for Silverlight SDK and Toolkit controls. The design time for Silverlight 3 SDK controls has been released with <a href="http://www.microsoft.com/downloads/details.aspx?familyid=1EA49236-0DE7-41B1-81C8-A126FF39975B&amp;displaylang=en" target="_blank">SL3 SDK</a> in August 2009, and is also chain installed by VS2010 Beta2. The design time for Toolkit controls, together with sources for both SDK and Toolkit controls, and their design time, samples, unit tests etc, are in <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>&#160;<a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30514" target="_blank">October 2009 Release</a>. We purposely made October 2009 release to be in sync with Visual Studio 2010 Beta 2 on Monday, 10/19/2009. This post demonstrates the new design time experiences for Silverlight controls in VS2010. </p>
<h3>Install</h3>
<p>VS2010 installs side by side with VS2008. Multiple releases of Toolkit install side by side too. So it is perfectly safe to install VS2010 and Toolkit October 2009 release on your main machine. The only caveat is that if you have a pre August 2009 version of Silverlight 3 SDK installed, you will need to uninstall it first, before installing VS2010. You can install VS2010 Beta2 from <a title="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx">http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx</a>, and Silverlight Toolkit from <a href="http://silverlight.codeplex.com">http://silverlight.codeplex.com</a>.</p>
<h3>Walkthrough</h3>
<p>The October 2009 release is for Silverlight 3 only. It provides design time support for both VS2008 and VS2010, as well as Blend 3. Below walkthrough will be VS2010 only. Design time experience for VS2008 and Blend 3 are similar to <a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24246" target="_blank">July 2009 release</a>. Please see my previous posts for design time experience with VS2008 and Blend3.</p>
<ul>
<li>Create a new Silverlight Application project in VS2010, notice that:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3New2.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Create New Silverlight Application Project" border="0" alt="Create New Silverlight Application Project" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3New_thumb2.png" width="584" height="407" /></a>
<ul>
<li>the toolbox is populated with both SDK and Toolkit controls, with nice icons. If you have Blend3 installed before Toolkit, you may see a lot of Blend controls on the toolbox that are not supposed to. You can safely remove them by right click a control in the toolbox and select delete. </li>
<li>it is a real designer: both the design view and the properties window work! </li>
</ul>
</li>
<li>double click TabControl in the toolbox will add a tabControl1. Notice that:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabCtrlInit2.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Add Tab Control from Toolbox" border="0" alt="Add Tab Control from Toolbox" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabCtrlInit_thumb2.png" width="584" height="404" /></a>
<ul>
<li>A reference to System.Windows.Controls.dll is added, together with a <font face="Lucida Console">xmlns definition: xmlns:controls=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls&quot;</font> </li>
<li>tabControl1 is initialized with a tabItem1, which itself is initialized with a header and &lt;Grid/&gt; content. (via <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.defaultinitializer.aspx" target="_blank">DefaultInitializer</a>) </li>
<li>Property Items is selected in the Properties window (via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.defaultpropertyattribute.aspx" target="_blank">DefaultPropertyAttribute</a>) </li>
<li>Properties are categorized (via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.categoryattribute.aspx" target="_blank">CategoryAttribute</a>), and have tooltip (via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.descriptionattribute.aspx" target="_blank">DescriptionAttribute</a>) </li>
</ul>
</li>
<li>Double click tabControl1 will add an event handler for SelectionChanged event (via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.defaulteventattribute.aspx" target="_blank">DefaultEventAttribute</a>)       <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabDefEvent2.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Default Event" border="0" alt="Default Event" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabDefEvent_thumb2.png" width="584" height="404" /></a> </li>
<li>right click tabControl1, select Add Tab (via <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.interaction.primaryselectioncontextmenuprovider.aspx" target="_blank">PrimarySelectionContextMenuProvider</a>):       <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddTabCM2.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3TabAddTabCM" border="0" alt="VS10SL3TabAddTabCM" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddTabCM_thumb1.png" width="584" height="404" /></a> </li>
<li>A new tabItem2 is added. Notice that:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddTabResult1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3TabAddTabResult" border="0" alt="VS10SL3TabAddTabResult" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddTabResult_thumb1.png" width="584" height="405" /></a>
<ul>
<li>tabItem2 is initialized with a &lt;Grid/&gt; content </li>
<li>tabItem2’s default property Header is highlighted. You can type into the text box next to it and change the object typed Header property directly. (via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverterattribute.aspx" target="_blank">TypeConverterAttribute</a>) </li>
<li>all properties have nice infotip </li>
</ul>
</li>
<li>double click DatePicker on toolbox:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3DatePickerAdd1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3DatePickerAdd" border="0" alt="VS10SL3DatePickerAdd" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3DatePickerAdd_thumb1.png" width="584" height="404" /></a>
<ul>
<li>a datePicker1 is added to tabItem2’s &lt;Grid&gt; (via <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.interaction.parentadapter.aspx" target="_blank">ParentAdapter</a>) </li>
<li>datePicker1 is fully expanded, even though its IsDropDownOpen property is false (via <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.designmodevalueprovider.aspx" target="_blank">DesignModeValueProvider</a>) </li>
</ul>
</li>
<li>Now click tabItem1, notice that tabItem2’s content is hidden and tabItem1’s is shown:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabItemSelect1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3TabItemSelect" border="0" alt="VS10SL3TabItemSelect" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabItemSelect_thumb1.png" width="584" height="404" /></a> </li>
<li>click Chart on toolbox:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddChartpng1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3TabAddChartpng" border="0" alt="VS10SL3TabAddChartpng" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3TabAddChartpng_thumb1.png" width="584" height="408" /></a>
<ul>
<li>a chart1 is added to the right place, initialized with sample data, and nicely rendered </li>
<li>default property Series is selected in the properties window </li>
</ul>
</li>
<li>click the … button next to Series property to pop up the Collection Editor:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3ChartSeries1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3ChartSeries" border="0" alt="VS10SL3ChartSeries" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3ChartSeries_thumb1.png" width="584" height="353" /></a>
<ul>
<li>the Select item ComboBox is populated with the correct types (via <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.propertyediting.newitemtypesattribute.aspx" target="_blank">NewItemTypesAttribute</a>). The pink background for the icons are fixed now. </li>
<li>the Properties window for the series highlights the default property DependentValuePath, have all properties categorized (like the Data Visualization category), and you can modify the object typed Title property directly in the text box. </li>
</ul>
</li>
<li>Create a simple data class with some simple properties, and add it as a data source, via Data |&#160; Show Data Sources menu item:&#160; <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Binding11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3Binding1" border="0" alt="VS10SL3Binding1" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Binding1_thumb1.png" width="584" height="396" /></a> </li>
<li>Drag MyData over tabItem1’s header and drop it :      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Binding21.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Data Binding" border="0" alt="Data Binding" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Binding2_thumb1.png" width="584" height="398" /></a>
<ul>
<li>a CollectionViewDataSource is inserted, used as <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.datacontext.aspx" target="_blank">DataContext</a> of the LayoutRoot, and tabItem1’s Header is bound to it. (Via <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.defaultbindingpropertyattribute.aspx" target="_blank">DefaultBindingPropertyAttribute</a>) </li>
</ul>
</li>
<li>Just for fun, open the project in Blend 3, you will see very similar design time behaviors:      <br /><a href="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Blend31.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="VS10SL3Blend3" border="0" alt="VS10SL3Blend3" src="http://www.ningzhang.org/wp-content/uploads/2009/10/VS10SL3Blend3_thumb1.png" width="584" height="439" /></a>&#160; </li>
<p> While VS2010 design time is the exciting new feature of this release, design time support for VS2008 and Blend 3 are still there and has lots of bug fixes. Please refer to previous post <a href="http://www.ningzhang.org/2009/03/19/silverlight-toolkit-design-time-features-march-2009-release-update/" target="_blank">Silverlight Toolkit Design Time Features: March 2009 Release Update</a> for more information for VS2008 and Blend 3 design time experience. </ul>
<h3>Conclusion</h3>
<p>Above walkthrough is only a peek into all the design time features we have implemented for VS2010. I am very excited that VS2010 now provides a real designer for Silverlight, and I will continue enriching the design time experience for Silverlight in VS and Blend. Your feedback is welcome.</p>
<p>I will write a series of posts explaining how those design time experience are implemented.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bfdefe3f-2272-4482-92ff-7ca1607220e9" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight+Toolkit" rel="tag">Silverlight Toolkit</a>,<a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Design+Time" rel="tag">Design Time</a>,<a href="http://technorati.com/tags/Visual+Studio+2010" rel="tag">Visual Studio 2010</a>,<a href="http://technorati.com/tags/Visual+Studio" rel="tag">Visual Studio</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update&amp;notes=Overview%20%20Visual%20Studio%202010%20Beta%202%20is%20available%20now.%20For%20Silverlight%20developers%2C%20the%20most%20exciting%20news%20about%20VS2010%20is%20that%20Silverlight%20designer%20will%20be%20in%20feature%20parity%20with%20WPF%20designer%2C%20and%20VS2010%20will%20support%20multi-targeting%20for%20Silverlight%20de" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=Overview%20%20Visual%20Studio%202010%20Beta%202%20is%20available%20now.%20For%20Silverlight%20developers%2C%20the%20most%20exciting%20news%20about%20VS2010%20is%20that%20Silverlight%20designer%20will%20be%20in%20feature%20parity%20with%20WPF%20designer%2C%20and%20VS2010%20will%20support%20multi-targeting%20for%20Silverlight%20de" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;t=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update&amp;annotation=Overview%20%20Visual%20Studio%202010%20Beta%202%20is%20available%20now.%20For%20Silverlight%20developers%2C%20the%20most%20exciting%20news%20about%20VS2010%20is%20that%20Silverlight%20designer%20will%20be%20in%20feature%20parity%20with%20WPF%20designer%2C%20and%20VS2010%20will%20support%20multi-targeting%20for%20Silverlight%20de" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F&amp;t=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Design%20Time%3A%20Toolkit%20October%202009%20Release%20Update&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F10%2F21%2Fsilverlight-design-time-toolkit-october-2009-release-update%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/da2jr16qkxQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/10/21/silverlight-design-time-toolkit-october-2009-release-update/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/10/21/silverlight-design-time-toolkit-october-2009-release-update/</feedburner:origLink></item>
		<item>
		<title>Silverlight Design Time: Toolkit July 2009 Release Update</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/ir8tNHY0Sxo/</link>
		<comments>http://www.ningzhang.org/2009/09/29/silverlight-design-time-toolkit-july-2009-release-update/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 22:38:19 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Design Time]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/09/29/silverlight-design-time-toolkit-july-2009-release-update/</guid>
		<description>I have been very busy and haven’t post for a while, so this is a quick late post on Toolkit July 2009 Release. This release is the last Toolkit release for Silverlight 2: when a new version of Silverlight RTMs, we drop support for the previous version, so each Toolkit release needs to support at [...]</description>
			<content:encoded><![CDATA[<p>I have been very busy and haven’t post for a while, so this is a quick late post on Toolkit <a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24246" target="_blank">July 2009 Release</a>. This release is the last Toolkit release for Silverlight 2: when a new version of Silverlight RTMs, we drop support for the previous version, so each Toolkit release needs to support at most two versions of Silverlight. As for design time feature updates, there have been a lot of improvements over <a href="http://www.ningzhang.org/2009/03/19/silverlight-toolkit-design-time-features-march-2009-release-update/" target="_blank">March 2009 Release</a>. I will use a simple walkthrough to highlight a few noticeable new features: </p>
<ul>
<li>Install Silverlight 3, Blend 3 and Toolkit from <a href="http://silverlight.net/getstarted/">http://silverlight.net/getstarted/</a> </li>
<li>Open Blend 3, create a new Silverlight 3 Application project </li>
<li>Open Asset Library, notice few improvements:
<ul>
<li>the new Asset Library. See Unni’s blog <a href="http://blogs.msdn.com/unnir/archive/2009/05/22/the-blend-3-asset-library.aspx" target="_blank">The Blend 3 Asset Library</a> for more info.&#160; </li>
<li>the nicer icons and more informative infotip </li>
</ul>
</li>
</ul>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/09/image.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Blend 3 Asset Library" border="0" alt="Blend 3 Asset Library" src="http://www.ningzhang.org/wp-content/uploads/2009/09/image_thumb.png" width="604" height="388" /></a> </p>
<ul>
<li>Add an Expander control, and set it as the new active container: </li>
</ul>
<p> <a href="http://www.ningzhang.org/wp-content/uploads/2009/09/image1.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pin Active Container " border="0" alt="Pin Active Container " src="http://www.ningzhang.org/wp-content/uploads/2009/09/image_thumb1.png" width="604" height="398" /></a>
<ul>
<li>Add a DatePicker to the Expander, notice that both the DatePicker and its Calendar drop down are shown, even though both Expander’s IsExpanded and DatePicker’s IsDropDownOpen are false. </li>
</ul>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/09/image2.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2009/09/image_thumb2.png" width="604" height="389" /></a> </p>
<ul>
<li>Select LayoutRoot so Expander and the nest DatePicker are no longer selected, notice that both are now collapsed. </li>
</ul>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/09/image3.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2009/09/image_thumb3.png" width="604" height="389" /></a> </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/09/image4.png" target="_blank"><img style="border-right-width: 0px; margin: 0px 0px 0px 20px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visual Studio Toolbox" border="0" alt="Visual Studio Toolbox" align="right" src="http://www.ningzhang.org/wp-content/uploads/2009/09/image_thumb4.png" width="206" height="663" /></a>Open the project in Visual Studio,notice that the Toolbox is populated with lots of controls from Silverlight SDK and Toolkit, with nice icons. </p>
<p>&#160;</p>
<p>So far, design time features for Silverlight are mostly exposed through Blend. This will change with next beta of Visual Studio 2010, which will come out soon, according to this Visual Studio Magazine <a href="http://visualstudiomagazine.com/Blogs/RDN-Express/2009/09/VS2010-and-.NET-4-Beta-2-Expected-Soon.aspx" target="_blank">article</a>. Stay tuned!</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update&amp;notes=I%20have%20been%20very%20busy%20and%20haven%E2%80%99t%20post%20for%20a%20while%2C%20so%20this%20is%20a%20quick%20late%20post%20on%20Toolkit%20July%202009%20Release.%20This%20release%20is%20the%20last%20Toolkit%20release%20for%20Silverlight%202%3A%20when%20a%20new%20version%20of%20Silverlight%20RTMs%2C%20we%20drop%20support%20for%20the%20previous%20vers" title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=I%20have%20been%20very%20busy%20and%20haven%E2%80%99t%20post%20for%20a%20while%2C%20so%20this%20is%20a%20quick%20late%20post%20on%20Toolkit%20July%202009%20Release.%20This%20release%20is%20the%20last%20Toolkit%20release%20for%20Silverlight%202%3A%20when%20a%20new%20version%20of%20Silverlight%20RTMs%2C%20we%20drop%20support%20for%20the%20previous%20vers" title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;t=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update&amp;annotation=I%20have%20been%20very%20busy%20and%20haven%E2%80%99t%20post%20for%20a%20while%2C%20so%20this%20is%20a%20quick%20late%20post%20on%20Toolkit%20July%202009%20Release.%20This%20release%20is%20the%20last%20Toolkit%20release%20for%20Silverlight%202%3A%20when%20a%20new%20version%20of%20Silverlight%20RTMs%2C%20we%20drop%20support%20for%20the%20previous%20vers" title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;title=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F&amp;t=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Silverlight%20Design%20Time%3A%20Toolkit%20July%202009%20Release%20Update&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F09%2F29%2Fsilverlight-design-time-toolkit-july-2009-release-update%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/ir8tNHY0Sxo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/09/29/silverlight-design-time-toolkit-july-2009-release-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/09/29/silverlight-design-time-toolkit-july-2009-release-update/</feedburner:origLink></item>
		<item>
		<title>Editing Model &amp; Default Initializer for Silverlight Controls</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/44AOjbTmESE/</link>
		<comments>http://www.ningzhang.org/2009/05/11/editing-model-default-initializer-for-silverlight-controls/#comments</comments>
		<pubDate>Mon, 11 May 2009 09:43:00 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Design Time]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Control]]></category>
		<category><![CDATA[DefaultInitializer]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/05/11/editing-model-default-initializer-for-silverlight-controls/</guid>
		<description>This is part of the series on design time feature implementation in Silverlight Toolkit. This post uses the Chart default initializer to illustrate how to implement default initializer for Silverlight controls, and explain the underlying editing model architecture.</description>
			<content:encoded><![CDATA[<p>
<link rel="stylesheet" type="text/css" href="http://www.ningzhang.org/codesnippet.css" />
</p>
<h3>Introduction</h3>
<p>This is part of the series on design time feature implementation in <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. This post uses the Chart default initializer to illustrate how to implement default initializer for Silverlight controls, and explain the underlying editing model architecture.</p>
<h3>Experience</h3>
<p>If you install <a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=20430#DownloadId=62369" target="_blank">Silverlight 3 Toolkit</a> in <a href="http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=20430" target="_blank">March 2009 Release</a>, you can drag the Chart control from Blend Asset Library and drop it onto designer surface, and you have a chart nicely initialized and rendered:</p>
<p><a href="http://www.ningzhang.org/2009/03/19/silverlight-toolkit-design-time-features-march-2009-release-update/" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Chart default initializer" src="http://www.ningzhang.org/wp-content/uploads/2009/03/image26.png" alt="Chart default initializer" width="604" height="350" /></a></p>
<p>You can read more about it in prior post <a href="http://www.ningzhang.org/2009/03/19/silverlight-toolkit-design-time-features-march-2009-release-update/" target="_blank">Silverlight Toolkit Design Time Features: March 2009 Release Update</a>.</p>
<h3>Architecture</h3>
<h4>DefaultInitializer</h4>
<p>It is actually pretty simple to provide a default initializer for a Silverlight control:</p>
<ul>
<li>implement a subclass of <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.defaultinitializer.aspx" target="_blank">DefaultInitializer</a>, and override its <a href="http://msdn.microsoft.com/en-us/library/bb532681.aspx" target="_blank">InitializeDefaults</a> function</li>
<li>associate the default initializer class with the control class via a <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.features.featureattribute.aspx" target="_blank">FeatureAttribute</a></li>
</ul>
<p>Below screenshot shows the implementation of DefaultInitializer abstract base class, and other classes in Microsoft.Windows.Design.Model namespace that will be discussed shortly:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DefaultInitializer" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb8.png" border="0" alt="DefaultInitializer" width="604" height="454" /></a></p>
<p>Initialization is done in InitializeDefaults override, and result is serialized into xaml. So the first step in implementing a default initializer is to define the desired xaml to be produced.</p>
<h4>Editing Model</h4>
<p>Once the result xaml is defined, I wish there is a higher level abstraction/method that would just take the xaml. But unfortunately we have to use a much lower level (thus more flexible and powerful) imperative API called editing model that consists of classes like <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelitem.aspx" target="_blank">ModelItem</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelproperty.aspx" target="_blank">ModelProperty</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelevent.aspx" target="_blank">ModelEvent</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelfactory.aspx" target="_blank">ModelFactory</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.services.modelservice.aspx" target="_blank">ModelService</a>. The MSDN page <a href="http://msdn.microsoft.com/en-us/library/bb514661.aspx" target="_blank">Editing Model Architecture</a> gives an basic overview:</p>
<blockquote><p>Your design-time implementation interacts with run-time controls though a programming interface called the editing model. The objects being designed are called editable objects.</p>
<p>Your controls are defined in Extensible Application Markup Language (XAML). You update the XAML for your controls programmatically by using the editing model.</p>
<p><img src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /><strong>Model, Wrapper, and View</strong></p>
<p><a></a></p>
<p>The editing model consists of three functional subunits: a model, a public wrapper that abstracts the model, and a view that represents the user interface (UI) of the model. The model and the view are separate, but the wrapper and model are closely related. The following illustration shows the relationship among the three subunits.</p>
<p><img src="http://i.msdn.microsoft.com/Bb514661.Cider_ModWrap(en-us,VS.90).png" alt="Model, ModelItem, and View relationships" /></p>
<p>The design environment uses the <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelitem.aspx">ModelItem</a> type to communicate with the underlying model. All changes are made to the <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelitem.aspx">ModelItem</a> wrappers, which affect the underlying model. This allows the model to be simple. The <a href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.modelitem.aspx">ModelItem</a> wrappers handle complex designer features, such as transaction support, undo tracking, and change notifications.</p></blockquote>
<p>Below class diagram may help explain interactions among core classes of the editing model:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image13.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Editing Model Class Diagram" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb9.png" border="0" alt="Editing Model Class Diagram" width="604" height="442" /></a></p>
<p>Use below xaml as an example:</p>
<p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">UserControl</span>
    <span class="attr">xmlns</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span>
    <span class="attr">xmlns:x</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml"</span>
    <span class="attr">x:Class</span><span class="kwrd">="ModelTest.Page"</span> <span class="attr">Width</span><span class="kwrd">="640"</span> <span class="attr">Height</span><span class="kwrd">="480"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Grid</span> <span class="attr">x:Name</span><span class="kwrd">="LayoutRoot"</span> <span class="attr">Background</span><span class="kwrd">="White"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Button</span> <span class="attr">x:Name</span><span class="kwrd">="Button"</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Rectangle</span> <span class="attr">x:Name</span><span class="kwrd">="Rectangle"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Button</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">UserControl</span><span class="kwrd">&gt;</span></pre>
</div>
</p>
<ul>
<li>ModelItem: assume variable <em>item </em>is the ModelItem for the Button control above,
<ul>
<li>Name is persisted as <em>x:Name</em> attribute in xaml: <em>item.Name = “Button” </em>is persisted in xaml as <em>x:Name = “Button”</em>.</li>
<li>ItemType is the Type object of the underlying control, and decides the tag used in xaml:<em> item.PropertyType == tyepof(Button)</em>, and the xaml tag is <em>&lt;Button /&gt;</em>.</li>
<li>Properties is the collection of properties, wrapped in ModelProperty type, of the underlying control. For example: <em>item[“ClickMode”] = ClickMode.Release </em>will be persisted in xaml as <em>ClickMode=&#8221;Release&#8221;</em>.</li>
<li>Content represents the Content property defined in ContentControl (and inherited by its subclasses): <em>item.Content </em>is the ModelItem representing the Rectangle object.</li>
<li>Source: when a ModelItem represents an element that’s a property of another element, Source is the ModelProperty wrapper of that property. For example, <em>item.Content.Value.Source == item.Content // the Rectangle</em>.</li>
<li>Events represents the collection of events of the underlying control, wrapped in ModelEvent type. From my debugging experience, it is always null, so it seems Events property is not yet supported by Blend3 for Silverlight3 yet.</li>
<li>Parent is the the logic parent of the underlying control, wrapped in ModelItem type. ex: item.Parent is the ModelItem for Grid.</li>
<li>Root is the ModelItem wrapper for root visual, ex: item.Root represents the UserControl.</li>
</ul>
</li>
<li>ModelProperty: assume variable <em>prop</em> is the ModelProperty for Button.Content, i.e. <em>prop = item.Content</em>,
<ul>
<li>Name is the name of the property of the underlying control. It is persisted in xaml as attribute name. ex: <em>prop.Name == “Content”</em>.</li>
<li>PropertyType is the Type object of the property of the underlying control this ModelProperty object represents. ex: <em>prop.PropertyType = typeof(object)</em>.</li>
<li>AttachedOwnerType is the Type object of the control that first defines the property this ModelProperty object represents. ex: <em>prop.AttachedOwnerType == typeof(ContentControl) // note: not Button.</em></li>
<li>Value is the value of the property of the underlying control, wrapped in ModelItem type. ex: prop.Value is the ModelItem representing the Rectangle object.</li>
<li>Parent is the control, wrapped in ModelItem type, of which the property belongs to. ex: <em>prop.Parent == item</em>.</li>
</ul>
</li>
<li>ModelEvent: as mentioned above, item.Events is always null, so it doesn’t seem that ModelEvent is supported in Blend3 for Silverlight3 yet. But assume it works, and variable evt is the ModelEvent for Button.Click, i.e., <em>evt = item.Events[“Click”]</em>,
<ul>
<li>Name is the name of the event. ex: evt.Name == “Click”.</li>
<li>EventType is the type of the event delegate, ex: <em>evt.EventType == typeof(RoutedEventHandler)</em>.</li>
<li>Handlers is the string collection of event handlers, ex: <em>evt.Handlers = new string[] { “Button_Click” }</em> will be persisted as <em>Click = “Button_Click”</em>. Note: this is pure speculation, since ModelEvent isn’t yet supported, and I don’t know whether/when/how it will be supported for Silverlight.</li>
<li>Parent is the control, wrapped in ModelItem type, of which this event belongs to. ex: <em>evt.Parent == item</em>.</li>
</ul>
</li>
</ul>
<h3>Implementation</h3>
<p>The Chart default initializer class ChartDefaultInitializer is implemented in ChartDefaultInitializer.cs, and registered in ChartMetadata.cs. Both files are in Controls.DataVisualization.Toolkit.Design.csproj of Silverlight.Controls.Design.sln. Please read prior post <a href="http://www.ningzhang.org/2008/12/28/design-time-feature-implementation-in-silverlight-toolkit/" target="_blank">Design Time Feature Implementation in Silverlight Toolkit</a> for more information.</p>
<h4>Result XAML</h4>
<p>As the first step, define the result xaml to be produced by ChartDefaultInitializer:</p>
<p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Charting:Chart</span> <span class="attr">Title</span><span class="kwrd">="Chart Title"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Charting:Chart.DataContext</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">PointCollection</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Point</span> <span class="attr">X</span><span class="kwrd">="1"</span> <span class="attr">Y</span><span class="kwrd">="10"</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Point</span> <span class="attr">X</span><span class="kwrd">="2"</span> <span class="attr">Y</span><span class="kwrd">="20"</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Point</span> <span class="attr">X</span><span class="kwrd">="3"</span> <span class="attr">Y</span><span class="kwrd">="30"</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Point</span> <span class="attr">X</span><span class="kwrd">="4"</span> <span class="attr">Y</span><span class="kwrd">="40"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">PointCollection</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Charting:Chart.Series</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Charting:ColumnSeries</span> <span class="attr">ItemsSource</span><span class="kwrd">="{Binding}"</span>
                <span class="attr">DependentValuePath</span><span class="kwrd">="X"</span>
                <span class="attr">IndependentValuePath</span><span class="kwrd">="Y"</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">Charting:Chart.Series</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">Charting:Chart.DataContext</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Charting:Chart</span><span class="kwrd">&gt;</span></pre>
 </div>
</p>
<h4>Registration</h4>
<p>Done in ChartMetadata.cs with following code:</p>
<div>
<pre id="codeSnippet" class="csharpcode">b.AddCustomAttributes(<span class="kwrd">new</span> FeatureAttribute(<span class="kwrd">typeof</span>(ChartDefaultInitializer)));</pre>
</div>
<h4>References</h4>
<p>See below screenshot:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image14.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="References" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb10.png" border="0" alt="References" width="544" height="454" /></a></p>
<p>Even though DefaultInitializer is defined in version 3.5 of Microsoft.Windows.Design.Interaction.dll (under %devenvdir%\PublicAssemblies, i.e. c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies on 32bit Windows), it is not supported by Blend2 or Visual Studio 2008 for Silverlight. It is supported by Blend3 and Visual Studio 2010, but they both switch to newer version of Microsoft.Windows.Design*.dll (3.7 for Blend 3 Preview, 4.0 for Blend 3 RTM and Visual Studio 2010), so we need to link against the newer version of MWDs. Please see prior post <a href="http://www.ningzhang.org/2009/03/31/how-to-write-silverlight-design-time-for-all-designers-visual-studio-2008-blend-2-blend-3-and-visual-studio-2010/" target="_blank">How to Write Silverlight Design Time for All Designers: Visual Studio 2008, Blend 2; Blend 3, and Visual Studio 2010</a> for more information.</p>
<p>Please also notice that reference to Silverlight’s System.Windows.dll is aliased, and the PointCollection is specifically called out to be the Silverlight one, not WPF’s. Since WPF and Silverlight share a lot of classes in same namespaces, <em>it is important that Silverlight types, not WPF’s, are used in creating ModelItem and ModelProperty in default initializer for Silverlight controls</em>.</p>
<h4>Collections</h4>
<p>Please note in below screenshot that while all other property value can be set via ModelProperty.SetValue:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image15.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ChartDefaultInitializer" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb11.png" border="0" alt="ChartDefaultInitializer" width="604" height="429" /></a></p>
<p>Chart.Series is of collection type (Collection&lt;Series&gt;), so its value has to be set by first creating a ModelItem via ModelFactory.CreateItem for the value, and then add the created ModelItem via ModelProperty.Collection.Add. Otherwise, even though the correct xaml may be generated, Blend won’t refresh to render the Chart control correctly, you have to reload the page to have it rendered correctly.</p>
<h4>ChartDefaultInitializer.cs</h4>
<p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="rem">// (c) Copyright Microsoft Corporation.</span>
<span class="rem">// This source is subject to the Microsoft Public License (Ms-PL).</span>
<span class="rem">// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.</span>
<span class="rem">// All other rights reserved.</span>

<span class="kwrd">extern</span> alias Silverlight;
<span class="kwrd">using</span> System.Windows.Controls.DataVisualization.Charting;
<span class="kwrd">using</span> System.Windows.Controls.Design.Common;
<span class="kwrd">using</span> Microsoft.Windows.Design.Metadata;
<span class="kwrd">using</span> Microsoft.Windows.Design.Model;
<span class="kwrd">using</span> SSW = Silverlight::System.Windows;
<span class="kwrd">using</span> SSWD = Silverlight::System.Windows.Data;
<span class="kwrd">using</span> SSWM = Silverlight::System.Windows.Media;

<span class="kwrd">namespace</span> System.Windows.Controls.DataVisualization.Design
{
    <span class="rem">/// &lt;summary&gt;</span>
    <span class="rem">/// Default initializer for chart. </span>
    <span class="rem">/// &lt;/summary&gt;</span>
    <span class="kwrd">internal</span> <span class="kwrd">class</span> ChartDefaultInitializer : DefaultInitializer
    {
        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// Sets the default property values for chart. </span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;param name="item"&gt;Chart ModelItem.&lt;/param&gt;</span>
        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">void</span> InitializeDefaults(ModelItem item)
        {
            <span class="kwrd">string</span> propertyName;

            <span class="rem">// &lt;Charting:Chart Title="Chart Title"&gt;</span>
            propertyName = Extensions.GetMemberName&lt;Chart&gt;(x =&gt; x.Title);
            item.Properties[propertyName].SetValue(Properties.Resources.ChartTitle);

            <span class="rem">// &lt;Charting:Chart.DataContext&gt;</span>
            <span class="rem">//     &lt;PointCollection&gt;</span>
            <span class="rem">//         &lt;Point X="1" Y="10" /&gt;</span>
            <span class="rem">//         &lt;Point X="2" Y="20" /&gt;</span>
            <span class="rem">//         &lt;Point X="3" Y="30" /&gt;</span>
            <span class="rem">//         &lt;Point X="4" Y="40" /&gt;</span>
            <span class="rem">//     &lt;/PointCollection&gt;</span>
            <span class="rem">// &lt;/Charting:Chart.DataContext&gt;</span>

            SSWM::PointCollection defaultItemsSource = <span class="kwrd">new</span> SSWM::PointCollection();
            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 1; i &lt;= 4; i++)
            {
                defaultItemsSource.Add(<span class="kwrd">new</span> SSW::Point(i, 10 * i));
            }

            propertyName = Extensions.GetMemberName&lt;Chart&gt;(x =&gt; x.DataContext);
            item.Properties[propertyName].SetValue(defaultItemsSource);

            <span class="rem">// &lt;Charting:Chart.Series&gt;</span>
            <span class="rem">//     &lt;Charting:ColumnSeries ItemsSource="{Binding}"</span>
            <span class="rem">//         DependentValuePath="X"</span>
            <span class="rem">//         IndependentValuePath="Y" /&gt;</span>
            <span class="rem">// &lt;/Charting:Chart.Series&gt;</span>

            ModelItem columnSeries = ModelFactory.CreateItem(item.Context, <span class="kwrd">typeof</span>(ColumnSeries));
            propertyName = Extensions.GetMemberName&lt;ColumnSeries&gt;(x =&gt; x.ItemsSource);
            columnSeries.Properties[propertyName].SetValue(ModelFactory.CreateItem(columnSeries.Context, <span class="kwrd">typeof</span>(SSWD::Binding)));
            propertyName = Extensions.GetMemberName&lt;ColumnSeries&gt;(x =&gt; x.DependentValuePath);
            columnSeries.Properties[propertyName].SetValue(<span class="str">"X"</span>);
            propertyName = Extensions.GetMemberName&lt;ColumnSeries&gt;(x =&gt; x.IndependentValuePath);
            columnSeries.Properties[propertyName].SetValue(<span class="str">"Y"</span>);

            propertyName = Extensions.GetMemberName&lt;Chart&gt;(x =&gt; x.Series);
            item.Properties[propertyName].Collection.Add(columnSeries);
        }
    }
}</pre>
 </div>
</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:49cdd6b9-c83e-4dd1-bc75-612e7b84e51b" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Silverlight">Silverlight</a>,<a rel="tag" href="http://technorati.com/tags/Design">Design</a>,<a rel="tag" href="http://technorati.com/tags/DefaultInitializer">DefaultInitializer</a>,<a rel="tag" href="http://technorati.com/tags/ModelItem">ModelItem</a>,<a rel="tag" href="http://technorati.com/tags/ModelProperty">ModelProperty</a>,<a rel="tag" href="http://technorati.com/tags/ModelEvent">ModelEvent</a>,<a rel="tag" href="http://technorati.com/tags/ModelFactory">ModelFactory</a>,<a rel="tag" href="http://technorati.com/tags/ModelService">ModelService</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;title=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls&amp;notes=This%20is%20part%20of%20the%20series%20on%20design%20time%20feature%20implementation%20in%20Silverlight%20Toolkit.%20This%20post%20uses%20the%20Chart%20default%20initializer%20to%20illustrate%20how%20to%20implement%20default%20initializer%20for%20Silverlight%20controls%2C%20and%20explain%20the%20underlying%20editing%20model%20architecture." title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;title=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=This%20is%20part%20of%20the%20series%20on%20design%20time%20feature%20implementation%20in%20Silverlight%20Toolkit.%20This%20post%20uses%20the%20Chart%20default%20initializer%20to%20illustrate%20how%20to%20implement%20default%20initializer%20for%20Silverlight%20controls%2C%20and%20explain%20the%20underlying%20editing%20model%20architecture." title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;t=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;title=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls&amp;annotation=This%20is%20part%20of%20the%20series%20on%20design%20time%20feature%20implementation%20in%20Silverlight%20Toolkit.%20This%20post%20uses%20the%20Chart%20default%20initializer%20to%20illustrate%20how%20to%20implement%20default%20initializer%20for%20Silverlight%20controls%2C%20and%20explain%20the%20underlying%20editing%20model%20architecture." title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;title=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F&amp;t=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Editing%20Model%20%26%20Default%20Initializer%20for%20Silverlight%20Controls&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F11%2Fediting-model-default-initializer-for-silverlight-controls%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/44AOjbTmESE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/05/11/editing-model-default-initializer-for-silverlight-controls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/05/11/editing-model-default-initializer-for-silverlight-controls/</feedburner:origLink></item>
		<item>
		<title>Migrate Windows Live Writer Data</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/U9oHUBH5DrI/</link>
		<comments>http://www.ningzhang.org/2009/05/08/migrate-windows-live-writer-data/#comments</comments>
		<pubDate>Fri, 08 May 2009 15:09:28 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Windows Live Writer]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2009/05/08/migrate-windows-live-writer-data/</guid>
		<description>This post discusses where Windows Live Writer saves its settings and data (like auto linking, dictionary, posts etc), how to migrate those data and settings, and how to find out more about Windows Live Writer via tools like procmon, reflector, and windbg.</description>
			<content:encoded><![CDATA[<p>I am re-imaging my laptop with Windows 7 RC: it is so much fun and productivity boost to spend a day or two re-installing and re-configuring OS and apps <img src='http://www.ningzhang.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  One of my favorite apps is <a href="http://download.live.com/writer" target="_blank">Windows Live Writer</a>, so I need to migrate all my Windows Live Writer settings and data. This is what I did:</p>
<ul>
<li><a href="http://technet.microsoft.com/en-us/library/cc733145.aspx" target="_blank">robocopy</a> posts under “%userprofile%\Documents\My Weblog Posts”</li>
<li>copy auto linking entries in “%appdata%\Windows Live Writer\LinkGlossary\linkglossary.xml”</li>
</ul>
<p>For those curious, this is where Windows Live Writer settings are stored:</p>
<ul>
<li>posts:<br />
<img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WLW posts directory" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image5.png" border="0" alt="WLW posts directory" width="447" height="289" /></li>
<li>User dictionaries, keywords and auto links:<br />
<a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WLW config directory" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb6.png" border="0" alt="WLW config directory" width="554" height="295" /></a></li>
<li>other settings in registry:<br />
<a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image11.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WLW settings in registry" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb7.png" border="0" alt="WLW settings in registry" width="554" height="270" /></a></li>
</ul>
<p>For those even more curious, this is how I found out where those settings are, besides web search:</p>
<ul>
<li> configuration is usually persisted in registry and/or files, and those registry and files usually follow well known path convention. Registry is usually a good start. For files, try %appdata% and/or &#8220;%userprofile%.</li>
<li>use <a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" target="_blank">sysinternals</a>’ <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" target="_blank">procmon</a> to see what registry and files a process is accessing:<br />
<a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image8.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="procmon on linkglossary.xml" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb4.png" border="0" alt="procmon on linkglossary.xml" width="554" height="198" /></a></li>
<li>for managed code, load all their assemblies (usually under %programfiles%) into <a href="http://en.wikipedia.org/wiki/.NET_Reflector" target="_blank">reflector</a>, and see how it is implemented:<br />
<a href="http://www.ningzhang.org/wp-content/uploads/2009/05/image9.png" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="reflector on LinkGlossary" src="http://www.ningzhang.org/wp-content/uploads/2009/05/image-thumb5.png" border="0" alt="reflector on LinkGlossary" width="554" height="277" /></a></li>
</ul>
<ul> Happy blogging, and hacking <img src='http://www.ningzhang.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </ul>
<p> </p>
<p> </p>
<p> </p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1848c3e0-d0d2-4742-ae17-eec381875305" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Windows+Live+Writer">Windows Live Writer</a></div>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;partner=sociable" title="Print"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Migrate%20Windows%20Live%20Writer%20Data&amp;body=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F" title="email"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.ningzhang.org/feed/" title="RSS"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Migrate%20Windows%20Live%20Writer%20Data%20-%20http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F" title="Twitter"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="TwitThis"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;title=Migrate%20Windows%20Live%20Writer%20Data&amp;notes=This%20post%20discusses%20where%20Windows%20Live%20Writer%20saves%20its%20settings%20and%20data%20%28like%20auto%20linking%2C%20dictionary%2C%20posts%20etc%29%2C%20how%20to%20migrate%20those%20data%20and%20settings%2C%20and%20how%20to%20find%20out%20more%20about%20Windows%20Live%20Writer%20via%20tools%20like%20procmon%2C%20reflector%2C%20and%20windbg." title="del.icio.us"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;title=Migrate%20Windows%20Live%20Writer%20Data&amp;source=Ning+Zhang%26%23039%3Bs+Blog+About+Silverlight%2C+Microsoft+technologies%2C+and+software+development+in+general.&amp;summary=This%20post%20discusses%20where%20Windows%20Live%20Writer%20saves%20its%20settings%20and%20data%20%28like%20auto%20linking%2C%20dictionary%2C%20posts%20etc%29%2C%20how%20to%20migrate%20those%20data%20and%20settings%2C%20and%20how%20to%20find%20out%20more%20about%20Windows%20Live%20Writer%20via%20tools%20like%20procmon%2C%20reflector%2C%20and%20windbg." title="LinkedIn"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F" title="Technorati"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;t=Migrate%20Windows%20Live%20Writer%20Data" title="Facebook"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;title=Migrate%20Windows%20Live%20Writer%20Data&amp;annotation=This%20post%20discusses%20where%20Windows%20Live%20Writer%20saves%20its%20settings%20and%20data%20%28like%20auto%20linking%2C%20dictionary%2C%20posts%20etc%29%2C%20how%20to%20migrate%20those%20data%20and%20settings%2C%20and%20how%20to%20find%20out%20more%20about%20Windows%20Live%20Writer%20via%20tools%20like%20procmon%2C%20reflector%2C%20and%20windbg." title="Google Bookmarks"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;title=Migrate%20Windows%20Live%20Writer%20Data" title="Live"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F&amp;t=Migrate%20Windows%20Live%20Writer%20Data" title="MySpace"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Migrate%20Windows%20Live%20Writer%20Data&uri=http%3A%2F%2Fwww.ningzhang.org%2F2009%2F05%2F08%2Fmigrate-windows-live-writer-data%2F" title="QQ书签"><img src="http://www.ningzhang.org/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/U9oHUBH5DrI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2009/05/08/migrate-windows-live-writer-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/05/08/migrate-windows-live-writer-data/</feedburner:origLink></item>
	</channel>
</rss>
