<?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>Thu, 14 Apr 2011 22:47:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<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 5 Beta Development Tools</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/oDiTzqhGUeg/</link>
		<comments>http://www.ningzhang.org/2011/04/14/silverlight-5-beta-development-tools/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 22:47:00 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2011/04/14/silverlight-5-beta-development-tools/</guid>
		<description>Silverlight 5 Beta was announced at MIX11 yesterday. This blog post is an overview of Silverlight 5 development tools. To get started, download following components: Recommended Downloads Visual Studio 2010 SP1 (required) Silverlight 5 Beta Tools for Visual Studio SP1 (required) Expression Blend Preview for Silverlight 5(optional) &amp;#160; VS/VWD 2010 SP1 + SL5Tools SL4 development [...]</description>
			<content:encoded><![CDATA[<p><a href="http://www.silverlight.net/getstarted/silverlight-5-beta/" target="_blank">Silverlight 5 Beta</a> was announced at MIX11 yesterday. This blog post is an overview of Silverlight 5 development tools. To get started, download following components:</p>
<blockquote><h5>Recommended Downloads</h5>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=209902">Visual Studio 2010 SP1</a> (required) </li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=214309">Silverlight 5 Beta Tools for Visual Studio SP1</a> (required) </li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=215203">Expression Blend Preview for Silverlight 5</a>(optional) </li>
</ul>
</blockquote>
<p>&#160;</p>
<h2>VS/VWD 2010 SP1 + SL5Tools</h2>
<p>SL<strong>4</strong> development requires VS2010 or VWD2010 <strong>RTM</strong> and SL4Tools, and optionally Blend 4. VS2010 <strong>SP1</strong> has SL4 support built in, so SL4Tools is not needed if you’ve already upgraded to VS2010 SP1. SL<strong>5</strong> development requires VS2010 or VWD2010 <strong>SP1</strong> and SL5Tools, and optionally Blend Preview for Silverlight 5. </p>
<h3>Install</h3>
<p>SL5 Beta Tools installs Silverlight 5 Beta Developer Runtime, SDK, Update to VS2010 SP1 (KB2502836), and WCF RIA Services V1.0 SP2 Preview. </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb.png" width="485" height="454" /></a></p>
<h3>Multi-targeting</h3>
<p>Once installed, you can create SL5 projects like you used to with previous versions of SL: </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image1.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb1.png" width="524" height="420" /></a></p>
<p>SL5 projects can reference assemblies built against early versions of Silverlight. Below screenshot shows a SL5 project using SL4 SDK via Project-&gt;Add Reference…–&gt;Browse:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image2.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb2.png" width="604" height="428" /></a></p>
<p>And the result in .csproj file: </p>
<blockquote><p>&lt;Reference Include=&quot;System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL&quot;&gt;      <br />&#160; &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;       <br />&#160; &lt;HintPath&gt;..\..\..\..\..\..\..\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.dll&lt;/HintPath&gt;       <br />&lt;/Reference&gt;       </p>
</blockquote>
<p>Please notice the HintPath and assembly version (Btw, SL5 increased assembly version from 2.0.5.0 to 5.0.5.0).</p>
<p>You can also upgrade existing SL4 projects to target SL5: </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image3.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb3.png" width="597" height="454" /></a></p>
<p>The upgrade changes &lt;ProjectGuid&gt; and &lt;TargetFrameworkVersion&gt; in .csproj, as well as upgrading all SDK references to SL5’s. </p>
<h3>Binding Debugging</h3>
<p>A popular new feature in SL5Tools is xaml binding debugging: </p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image4.png" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb4.png" width="604" height="428" /></a></p>
<p>&#160;</p>
<h2>Blend Preview for Silverlight 5</h2>
<p>Optionally, you can also install Blend Preview for Silverlight 5, which is basically Blend 4 with SL5 support:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image5.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb5.png" width="604" height="454" /></a></p>
<p>And you can use both VS and Blend on the same SL5 project and switch between them:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image6.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb6.png" width="604" height="454" /></a></p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image7.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb7.png" width="604" height="428" /></a></p>
<p>&#160;</p>
<h2>Troubleshoot &amp; Uninstall</h2>
<p>VS2010 SP1, SL5Tools and Blend Preview install all take a long time, so please be patient. If you run into install issues, you may want to take a look at install logs in %temp% directory, and attach those logs when you report install issues to Microsoft:</p>
<blockquote><p>C:\Users\ningz\AppData\Local\Temp&gt;dir /b /o-d *silver*      <br />Silverlight 5 Beta Tools for Visual Studio 2010 SP1_20110413_220121704.html       <br />Silverlight 5 Beta Tools for Visual Studio 2010 SP1_20110413_220121704-MSI_RiaServices.msi.txt       <br />Silverlight 5 Beta Tools for Visual Studio 2010 SP1_20110413_220121704-MSI_silverlight_sdk.msi.txt       <br />Silverlight0.log       </p>
</blockquote>
<p>To uninstall Silverlight 5 tools, use control panel to uninstall each component individually:</p>
<ul>
<li>SL5 runtime, SDK, RIA Services, Blend Preview </li>
</ul>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image8.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb8.png" width="604" height="291" /></a></p>
<ul>
<li>And Update to VS2010 (KB2502836) (please click “View installed updates” to see below) </li>
</ul>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2011/04/image9.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.ningzhang.org/wp-content/uploads/2011/04/image_thumb9.png" width="604" height="256" /></a></p>
<p>&#160;</p>
<p>Enjoy developing against Silverlight 5!</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:4df63783-e095-4b42-8016-c3c44cdf4809" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Silverlight+5" rel="tag">Silverlight 5</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>
<img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/oDiTzqhGUeg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2011/04/14/silverlight-5-beta-development-tools/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2011/04/14/silverlight-5-beta-development-tools/</feedburner:origLink></item>
		<item>
		<title>Touch Support in Silverlight</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/N1ZPqA2lkCc/</link>
		<comments>http://www.ningzhang.org/2010/10/08/touch-support-in-silverlight/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 10:44:23 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Manipulation]]></category>
		<category><![CDATA[Touch]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/10/08/touch-support-in-silverlight/</guid>
		<description>This post is a modification of MSDN articles Multitouch Input and Gesture Support for Windows Phone, as a quick overview and reference for myself on Silverlight touch support. &amp;#160; Overview Below class diagram shows key classes for Silverlight touch support: Touch Touch events are asynchronous. Touch events are always fired via application level Touch.FrameReported event. [...]</description>
			<content:encoded><![CDATA[<p>This post is a modification of MSDN articles <a href="http://msdn.microsoft.com/en-us/library/dd894494(VS.95).aspx" target="_blank">Multitouch Input</a> and <a href="http://msdn.microsoft.com/en-us/library/ff967546(VS.92).aspx" target="_blank">Gesture Support for Windows Phone</a>, as a quick overview and reference for myself on Silverlight touch support.</p>
<p>&#160;</p>
<h4>Overview</h4>
<p>Below class diagram shows key classes for Silverlight touch support:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/SLTouch.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Silverlight Touch Class Diagram" border="0" alt="Silverlight Touch Class Diagram" src="http://www.ningzhang.org/wp-content/uploads/2010/10/SLTouch_thumb.png" width="604" height="726" /></a></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/dd728833(v=VS.95).aspx" target="_blank">Touch</a>
<ul>
<li>Touch events are asynchronous. </li>
<li>Touch events are always fired via application level <a href="http://msdn.microsoft.com/en-us/library/dd728833(v=VS.95).aspx" target="_blank">Touch</a>.<a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.framereported(VS.95).aspx" target="_blank">FrameReported</a> event. </li>
<li>Since touch events are global, they are direct, and there is no need for touch capture. </li>
<li>Multitouch is supported. </li>
</ul>
</li>
<li>Manipulation
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulation.aspx" target="_blank">Manipulation</a> events are exposed by UIElement. They are routed events. </li>
<li>Manipulation events are always fired, IsManipulationEnabled property isn’t supported. </li>
<li>Manipulation events are synchronous. </li>
<li>Only translation and expansion are supported, rotation is not. </li>
<li>Concurrent multiple manipulations are not supported. </li>
<li>Gesture isn’t supported directly. It is supported by <a href="http://msdn.microsoft.com/en-us/library/ff434208.aspx" target="_blank">XNA</a> and <a href="http://blogs.msdn.com/b/delay/archive/2010/09/16/pining-for-windows-phone-7-controls-we-got-ya-covered-announcing-the-first-release-of-the-silverlight-for-windows-phone-toolkit.aspx" target="_blank">Silverlight for Windows Phone Toolkit</a>. </li>
</ul>
</li>
<li>Controls: on Windows Phone 7, ScrollViewer supports pan &amp; flick, Button supports tab. </li>
</ul>
<h4>Silverlight 3</h4>
<h5>Platform Requirements</h5>
<p>Multitouch requires an environment (device; platform and operating system; hosting application such as a browser) that can propagate the touch input to an individual application, such as your Silverlight-based application.</p>
<p>Windows 7 supports multitouch input at the operating system level. This is supported in part through a message (<a href="http://msdn.microsoft.com/en-us/library/dd317341(VS.85).aspx" target="_blank">WM_TOUCH</a>). Already at this level, the operating system provides a promotion of multitouch messages to mouse messages. The promotion is present so that multitouch users can use touch and gestures to substitute as mouse moves or mouse clicks. This is useful when interacting with applications that may not be touch-aware, and the application does all its spatial input processing through mouse events and messages. Windows 7 also coalesces the messages when appropriate, so that applications do not have to process an overflow of intermediate messages that all generate incremental events.</p>
<p>Internet Explorer version 8 as a browser host is also multitouch aware. Internet Explorer version 8 forwards platform multitouch messages to plug-ins such as Silverlight that are running within Internet Explorer, such that Silverlight applications can interact with multitouch input.</p>
<p>Multitouch Input for Silverlight (shown for IE8 host)</p>
<p><img title="Multitouch Input and Platform Input in Silverlight" alt="Multitouch Input and Platform Input in Silverlight" src="http://i.msdn.microsoft.com/dynimg/IC303288.png" /></p>
<p>Multitouch is also supported for Silverlight in current versions of Firefox hosts running on Windows 7, and for out-of-browser applications running on Windows 7. However, multitouch input is not supported for applications running in <a href="http://msdn.microsoft.com/en-us/library/cc189023(v=VS.95).aspx">full-screen</a> mode.</p>
<h5>Registering for Multitouch</h5>
<p>As part of the broader platform architecture for multitouch, each application that wants to receive multitouch messages must register its HWND (Touch API for Windows 7 includes <a href="http://msdn.microsoft.com/en-us/library/dd317326(VS.85).aspx" target="_blank">RegisterTouchWindow</a> for this purpose). The Silverlight 4 run time takes care of this registration step, and registers Silverlight as a runtime and all applications that use Silverlight as the runtime. Therefore it is not generally necessary to interact directly with platform code to process multitouch input. However, the characteristics of multitouch interaction within Touch API for Windows 7 and Silverlight 4 multitouch are fairly specific:</p>
<ul>
<li>
<p>Silverlight 4 is registered for raw touch input, not gestures. If your requirements include gestures, you have to process touch input into gestures using your own application code, within the context of Silverlight. Alternatively, you may need a larger interoperation design so that you can include a separate HWND that is multitouch registered for gestures from the platform, and interoperates with a Silverlight content area.</p>
</li>
<li>
<p>In general, Silverlight 4 promotes raw touch input to mouse events. (However, on a per-touchframe basis, you can disable promotion, as is described in upcoming sections of this topic.)</p>
</li>
<li>
<p>Within a host, certain gestures might be promoted by the browser host to become events other than mousedown/mousemove/mouseup.</p>
</li>
</ul>
<h5>Promotion to Mouse Events</h5>
<p>Mouse event promotion exists so that multitouch users can use touch and gestures to substitute as mouse moves or mouse clicks. Conceptually this is the default, because applications that predate or do not consider multitouch would not know what API to call to perform the promotion, and therefore the platform does the mouse promotion in most cases. Silverlight 4 perpetuates the general concept of mouse event promotion for much the same reasons. Any given existing Silverlight control might have handlers for mouse events, but not specifically for multitouch events. For example, a button would be expected to act as if clicked when the user used a multitouch device to interact with it.</p>
<p>Mouse event promotion does have the potential for event dualism in cases where there is deliberate handling of a multitouch frame and its touch points. Within the body of the handler for a Silverlight multitouch event, you can suspend mouse event promotion for the duration of the primary touch down. For example, if you wanted to create a touch-aware button that performed different actions based on the touch characteristics, you could suspend the promotion so that your button did not promote to the usual &quot;click&quot; behavior, and instead went to your discrete logic for how to handle the input. To do this, call <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventargs.suspendmousepromotionuntiltouchup(v=VS.95).aspx">SuspendMousePromotionUntilTouchUp</a> as one of the first operations of your handler.</p>
<p>The exact nature of mouse promotion is not documented here, because it is a platform characteristic. Generally speaking, the mechanism is a message-to-message promotion.</p>
<h5>Touch to Gesture</h5>
<p>Silverlight processes multitouch messages at the level of the raw message, analogous to the platform WM_TOUCH, along with access to other APIs that can capture touchpoint characteristics at that raw level that are then exposed as Silverlight APIs. Silverlight does not natively process touch to gestures, use the platform capabilities to that effect, or process <a href="http://msdn.microsoft.com/en-us/library/dd353242(VS.85).aspx" target="_blank">WM_GESTURE</a>. (Processing WM_GESTURE would require a registration state with the platform that Silverlight 4 does not opt into.)</p>
<p>If you want to process multitouch using the gesture metaphor, your code must handle the touch events and use the API exposed under Silverlight 4 and process into gestures, with or without using the platform API for gestures. This is not trivial.</p>
<h5>Touch API</h5>
<p>One important difference between multitouch input and other input techniques supported in Silverlight (mouse, keyboard, stylus) is that you register for multitouch events on an application-wide basis, not by adding handlers to specific input elements (<a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(v=VS.95).aspx">UIElement</a> objects). This is consistent with the metaphor that Silverlight as a whole is the &quot;application&quot; registered with the platform.</p>
<ul>
<li>
<p>To assign a multitouch event handler, you assign a handler for the static event <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.framereported(v=VS.95).aspx">Touch.FrameReported</a>. <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch(v=VS.95).aspx">System.Windows.Input.Touch</a> is a static service class that exists solely for this purpose with <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.framereported(v=VS.95).aspx">Touch.FrameReported</a> as its only API.</p>
</li>
<li>
<p>The handler you write for <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.framereported(v=VS.95).aspx">Touch.FrameReported</a> is based on the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventhandler(v=VS.95).aspx">TouchFrameEventHandler</a> delegate.</p>
</li>
<li>
<p>In a typical UI design, you might have areas of the UI that you intend to support specific multitouch actions within, and other areas where it would be better to use mouse promotion and not necessarily process the input as multitouch. To determine where the primary touch point is, you may have to evaluate the overall coordinate against the location of your multitouch-aware element, and its bounds. See <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventargs.getprimarytouchpoint(v=VS.95).aspx">GetPrimaryTouchPoint</a> for more information and example code.</p>
</li>
<li>
<p>As mentioned previously, you may want to suspend mouse event promotion as part of your <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventhandler(v=VS.95).aspx">TouchFrameEventHandler</a> logic. To do this, call <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventargs.suspendmousepromotionuntiltouchup(v=VS.95).aspx">SuspendMousePromotionUntilTouchUp</a> as one of the first operations.</p>
</li>
<li>
<p>Touch messages as reported to Silverlight 4 are typically combined as frames, which start with a primary &quot;down&quot; touch point. Sometimes you are only interested in the first touch point and the first &quot;up&quot; But the frame may contain other touch points and &quot;move&quot; actions. To access the full collection of points in a frame in your handlers, call <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventargs.gettouchpoints(v=VS.95).aspx">GetTouchPoints</a>. For a given touch point, probably the most important information is its <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchpoint.position(v=VS.95).aspx">Position</a>.</p>
</li>
<li>
<p>Other APIs expose information that in the platform API would be found in the TOUCHINPUT structure. Examples of such API are:<a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchframeeventargs.timestamp(v=VS.95).aspx">TouchFrameEventArgs.Timestamp</a>; <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchdevice.directlyover(v=VS.95).aspx">TouchDevice.DirectlyOver</a>; <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchpoint.size(v=VS.95).aspx">TouchPoint.Size</a>; <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touchpoint.touchdevice(v=VS.95).aspx">TouchPoint.TouchDevice</a>. Depending on your scenario, you might not always need this level of information.</p>
</li>
</ul>
<h5>Manipulation API in Silverlight Version 4</h5>
<p>The Silverlight 4 <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(v=VS.95).aspx">UIElement</a> class has several events related to manipulations, as well as event support classes such as <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationstartedeventargs(v=VS.95).aspx">ManipulationStartedEventArgs</a>. However, these APIs and the related manipulation concepts do not have full support under Silverlight 4 at run time. To handle these events, your application must be targeting Silverlight for Windows Phone. The events exist in the Silverlight 4 assemblies in order to provide common designer support for both Silverlight 4 and Silverlight for Windows Phone.</p>
<p>&#160;</p>
<h4>
<ul>Silverlight for Windows Phone 7</ul>
</h4>
<h5>Gesture Support in the Silverlight Framework</h5>
<p>For a full list of supported Windows Phone Silverlight gestures, see the <a href="http://go.microsoft.com/fwlink/?LinkID=183218">UI Design and Interaction Guide</a>.</p>
<p>Silverlight for Windows Phone allows you to process touch input by using manipulation events. By using these events, you can move and scale objects in response to touch and multi-touch input. The events are described in the following table.</p>
<p><span style="text-align: ; widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; white-space: normal; orphans: 2; color: ; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="text-align: left; font-family: ; font-size: " class="Apple-style-span"></span><br />
<table style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; background-color: transparent; width: ; border-collapse: collapse; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; word-spacing: normal" width="591">
<tbody>
<tr style="vertical-align: top">
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="143" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Event</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="446" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Description</font></p>
</th>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="143">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">ManipulationStarted</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="446">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">This event occurs when the user starts a direct manipulation by placing their finger or fingers on the screen.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="143">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">ManipulationDelta</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="446">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">This event occurs repeatedly while the user is moving their finger or fingers on the screen.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="143">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">ManipulationCompleted</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="446">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">This event occurs when the user removed their finger or fingers from the screen</font></p>
</td>
</tr>
</tbody>
</table>
<p>   </span></p>
<p><img title="Note" alt="Note" src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" /><strong>Note:</strong></p>
<p>Silverlight controls that are supported on Windows Phone are gesture-aware, and support gestures such as tap, pan, and flick. You can handle simple gestures such as tap, double-tap, and tap-and-hold by using mouse events. For more information, see the <a href="http://go.microsoft.com/fwlink/?LinkId=200842">Input for Windows Phone</a> topic.</p>
<p>&#160;</p>
<h5>Gesture Support in the XNA Framework</h5>
<p>The XNA framework offers a robust touch gesture system for developing applications. Developers can leverage this built-in gesture system instead of implementing one from scratch. The following XNA gestures are supported in Windows Phone.</p>
<p><span style="text-align: ; widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; white-space: normal; orphans: 2; color: ; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="text-align: left; font-family: ; font-size: " class="Apple-style-span"></span><br />
<table style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; background-color: transparent; width: ; border-collapse: collapse; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; word-spacing: normal" width="575">
<tbody>
<tr style="vertical-align: top">
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="82" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">GestureType</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="491" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Description</font></p>
</th>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Tap</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger touches the screen and releases.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">DoubleTap</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">This gesture represents two taps in succession.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Hold</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger touches the screen and holds it in place for a brief period of time.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">FreeDrag</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger touches the screen and moves in any direction.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">VerticalDrag</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger touches the screen and moves in an up or down direction.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">HorizontalDrag</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger touches the screen and moves in a left or right direction.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">DragComplete</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Marks the end of a FreeDrag, VerticalDrag, or HorizontalDrag gesture.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Flick</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">A finger drags across the screen and is lifted up without stopping.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Pinch</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Two fingers press on the screen and move around.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="82">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">PinchComplete</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="491">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">This gesture marks the end of a Pinch gesture.</font></p>
</td>
</tr>
</tbody>
</table>
<p>   </span></p>
<p>The following list provides useful topics and articles for implementing gesture support in an XNA application:</p>
<ul>
<li>
<p><a href="http://go.microsoft.com/fwlink/?LinkId=200843">Working with Touch Input (Windows Phone)</a></p>
</li>
<li>
<p><a href="http://go.microsoft.com/fwlink/?LinkId=200844">Detecting Gestures on a Multi-touch Screen (Windows Phone)</a></p>
</li>
<li>
<p><a href="http://go.microsoft.com/fwlink/?LinkId=200845">Windows Phone 7 Gestures Compared</a></p>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/N1ZPqA2lkCc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/10/08/touch-support-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/10/08/touch-support-in-silverlight/</feedburner:origLink></item>
		<item>
		<title>Touch Support in WPF</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/caq07oWW0EM/</link>
		<comments>http://www.ningzhang.org/2010/10/08/touch-support-in-wpf/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 08:41:10 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[Manipulation]]></category>
		<category><![CDATA[Touch]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/10/08/touch-support-in-wpf/</guid>
		<description>This post is a slight modification of Touch and Manipulation on MSDN, as a quick overview and reference for myself on WPF touch support. Overview New hardware and API in the Windows 7 operating system provide applications the ability to receive input from multiple touches simultaneously. WPF enables applications to detect and respond to touch [...]</description>
			<content:encoded><![CDATA[<p>This post is a slight modification of <a href="http://msdn.microsoft.com/en-us/library/ms754010.aspx#touch_and_manipulation" target="_blank">Touch and Manipulation</a> on MSDN, as a quick overview and reference for myself on WPF touch support.</p>
<h4>Overview</h4>
<p>New hardware and API in the Windows 7 operating system provide applications the ability to receive input from multiple touches simultaneously. WPF enables applications to detect and respond to touch in a manner similar to responding to other input, such as the mouse or keyboard, by raising events when touch occurs.</p>
<p>WPF exposes two types of events when touch occurs: touch events and manipulation events. Touch events provide raw data about each finger on a touchscreen and its movement. Manipulation events interpret the input as certain actions.</p>
<h5>Prerequisites</h5>
<p>You need the following components to develop an application that responds to touch.</p>
<ul>
<li>Microsoft Visual Studio 2010. </li>
<li>Windows 7. </li>
<li>A device, such as a touchscreen, that supports Windows Touch. </li>
</ul>
<p>WPF exposes two types of events when touch occurs: touch events and manipulation events. Touch events provide raw data about each finger on a touchscreen and its movement. Manipulation events interpret the input as certain actions.</p>
<h5>Terminology</h5>
<p>The following terms are used when touch is discussed.</p>
<ul>
<li>Touch is a type of user input that is recognized by Windows 7. Usually, touch is initiated by putting fingers on a touch-sensitive screen. Note that devices such as a touchpad that is common on laptop computers do not support touch if the device merely converts the finger&#8217;s position and movement as mouse input. </li>
<li>Multitouch is touch that occurs from more than one point simultaneously. Windows 7 and WPF supports multitouch. Whenever touch is discussed in the documentation for WPF, the concepts apply to multitouch. </li>
<li>A manipulation occurs when touch is interpreted as a physical action that is applied to an object. In WPF, manipulation events interpret input as a translation, expansion, or rotation manipulation. </li>
<li>A touch device represents a device that produces touch input, such as a single finger on a touchscreen. </li>
</ul>
<h5>Controls that Respond to Touch</h5>
<p>The following controls can be scrolled by dragging a finger across the control if it has content that is scrolled out of view.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.combobox.aspx">ComboBox</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu.aspx">ContextMenu</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.aspx">DataGrid</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.aspx">ListBox</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.listview.aspx">ListView</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.menuitem.aspx">MenuItem</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.aspx">TextBox</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.toolbar.aspx">ToolBar</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.treeview.aspx">TreeView</a> </li>
</ul>
<ul>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.aspx">ScrollViewer</a> defines the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.panningmode.aspx">ScrollViewer.PanningMode</a> attached property that enables you to specify whether touch panning is enabled horizontally, vertically, both, or neither. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.panningdeceleration.aspx">ScrollViewer.PanningDeceleration</a> property specifies how quickly the scrolling slows down when the user lifts the finger from the touchscreen. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.panningratio.aspx">ScrollViewer.PanningRatio</a> attached property specifies the ratio of scrolling offset to translate manipulation offset.</ul>
<ul></ul>
<h5>Class Diagram</h5>
<p>Below class diagram highlights the key classes and their members for touch support:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/WpfTouchEvents.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WPF Touch Events Class Diagram" border="0" alt="WPF Touch Events Class Diagram" src="http://www.ningzhang.org/wp-content/uploads/2010/10/WpfTouchEvents_thumb.png" width="604" height="391" /></a></p>
<ul>
<li>Touch
<ul>
<li>Touch events are exposed both by <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement3d.aspx">UIElement3D</a>, and <a href="http://msdn.microsoft.com/en-us/library/system.windows.contentelement.aspx">ContentElement</a> as bubbling events, and via <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.aspx" target="_blank">Touch</a>.<a href="http://msdn.microsoft.com/en-us/library/system.windows.input.touch.framereported.aspx" target="_blank">FrameReported</a> as application level event (to be compatible with Silverlight). </li>
<li>While touch down, move and up events are both tunneling and bubbling, touch enter and leave events are bubbling only. </li>
<li>Touch device capture is explicit via <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a>.<a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.capturetouch.aspx" target="_blank">CaptureTouch</a> method. </li>
<li>Touch events are synchronous. </li>
<li>Touch events are always fired, whether manipulation events are fired or not. </li>
<li>WPF supports multitouch. </li>
</ul>
</li>
<li>Manipulation
<ul>
<li>Manipulation events are exposed by <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> as bubbling event only. </li>
<li>Manipulation events are fired on an <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> only its <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.ismanipulationenabled.aspx">IsManipulationEnabled</a> is true. </li>
<li>Manipulation events are synchronous. </li>
<li>WPF supports three types of manipulation: expansion and rotation (including single finger rotation with pivot point), and inertia.</li>
<li>Touch device capture is implicit with manipulation. </li>
<li>Static class <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulation.aspx" target="_blank">Manipulation</a> contains methods to get and update manipulation parameters outside of manipulation event handlers. It also contains methods for more advanced usage of manipulation logic, such as adding adding and removing manipulators.&#160; </li>
<li>WPF supports multiple gestures.</li>
<li>WPF doesn’t support gestures, or 3D manipulation.</li>
</ul>
</li>
<li>ScrollViewer has built-in support for manipulation and inertia, and it is customizable by applications. </li>
</ul>
<h4><font face="Verdana">Touch</font></h4>
<h5>Touch Events</h5>
<p>The base classes, <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement3d.aspx">UIElement3D</a>, and <a href="http://msdn.microsoft.com/en-us/library/system.windows.contentelement.aspx">ContentElement</a>, define events that you can subscribe to so your application will respond to touch. Touch events are useful when your application interprets touch as something other than manipulating an object. For example, an application that enables a user to draw with one or more fingers would subscribe to touch events.</p>
<p>All three classes define the following events, which behave similarly, regardless of the defining class.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown.aspx">TouchDown</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchmove.aspx">TouchMove</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchup.aspx">TouchUp</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchenter.aspx">TouchEnter</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchleave.aspx">TouchLeave</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchdown.aspx">PreviewTouchDown</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchmove.aspx">PreviewTouchMove</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchup.aspx">PreviewTouchUp</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.gottouchcapture.aspx">GotTouchCapture</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.losttouchcapture.aspx">LostTouchCapture</a> </li>
</ul>
<p>Like keyboard and mouse events, the touch events are routed events. The events that begin with Preview are tunneling events and the events that begin with Touch are bubbling events. When you handle these events, you can get the position of the input, relative to any element, by calling the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.toucheventargs.gettouchpoint.aspx">GetTouchPoint</a> or <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.toucheventargs.getintermediatetouchpoints.aspx">GetIntermediateTouchPoints</a> method.</p>
<h6>The Execution Path of Touch Events</h6>
<p>To understand the interaction among the touch events, consider the scenario where a user puts one finger on an element, moves the finger in the element, and then lifts the finger from the element. The following illustration shows the execution of the bubbling events (the tunneling events are omitted for simplicity).</p>
<p>The following list describes the sequence of the events in the preceding illustration.<img style="margin: 0px 8px 0px 0px; display: inline; float: left" title="The sequence of touch events." alt="The sequence of touch events." align="left" src="http://i.msdn.microsoft.com/dynimg/IC372337.png" /></p>
<ol>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchenter.aspx">TouchEnter</a> event occurs one time when the user puts a finger on the element.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown.aspx">TouchDown</a> event occurs one time.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchmove.aspx">TouchMove</a> event occurs multiple times as the user moves the finger within the element.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchup.aspx">TouchUp</a> event occurs one time when the user lifts the finger from the element.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchleave.aspx">TouchLeave</a> event occurs one time.</p>
<p> When more than two fingers are used, the events occur for each finger.</li>
</ol>
<h4>Manipulation and Inertia</h4>
<h5>Manipulation Events</h5>
<p>For cases where an application enables a user to manipulate an object, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> class defines manipulation events. Unlike the touch events that simply report the position of touch, the manipulation events report how the input can be interpreted. There are three types of manipulations, translation, expansion, and rotation. The following list describes how to invoke the three types of manipulations.</p>
<ul>
<li>
<p>Put a finger on an object and move the finger across the touchscreen to invoke a translation manipulation. This usually moves the object.</p>
</li>
<li>
<p>Put two fingers on an object and move the fingers closer together or farther apart from one another to invoke an expansion manipulation. This usually resizes the object.</p>
</li>
<li>
<p>Put two fingers on an object and rotate the fingers around each other to invoke a rotation manipulation. This usually rotates the object.</p>
</li>
</ul>
<p>More than one type of manipulation can occur simultaneously.</p>
<p>When you cause objects to respond to manipulations, you can have the object appear to have inertia. This can make your objects simulate the physical world. For example, when you push a book across a table, if you push hard enough the book will continue to move after you release it. WPF enables you to simulate this behavior by raising manipulation events after the user&#8217;s fingers releases the object.</p>
<p>For information about how to create an application that enables the user to move, resize, and rotate an object, see <a href="http://msdn.microsoft.com/en-us/library/ee649090.aspx">Walkthrough: Creating Your First Touch Application</a>.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> defines the following manipulation events.</p>
<ul>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx">ManipulationStarting</a></p>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarted.aspx">ManipulationStarted</a></p>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a></p>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx">ManipulationInertiaStarting</a></p>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationcompleted.aspx">ManipulationCompleted</a></p>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback.aspx">ManipulationBoundaryFeedback</a></p>
</li>
</ul>
<p>By default, a <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> does not receive these manipulation events. To receive manipulation events on a <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a>, set <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.ismanipulationenabled.aspx">UIElement.IsManipulationEnabled</a> to true.</p>
<h6>The Execution Path of Manipulation Events</h6>
<p>Consider a scenario where a user &quot;throws&quot; an object. The user puts a finger on the object, moves the finger across the touchscreen for a short distance, and then lifts the finger while it is moving. The result of this is that the object will move under the user&#8217;s finger and continue to move after the user lifts the finger.</p>
<p>The following illustration shows the execution path of manipulation events and important information about each event.</p>
<p>Manipulation events</p>
<p><img style="margin: 0px 8px 0px 0px; display: inline; float: left" title="The sequence of manipulation events." alt="The sequence of manipulation events." align="left" src="http://i.msdn.microsoft.com/dynimg/IC372338.png" /></p>
<p>The following list describes the sequence of the events in the preceding illustration.</p>
<ol>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx">ManipulationStarting</a> event occurs when the user places a finger on the object. Among other things, this event allows you to set the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationstartingeventargs.manipulationcontainer.aspx">ManipulationContainer</a> property. In the subsequent events, the position of the manipulation will be relative to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationstartingeventargs.manipulationcontainer.aspx">ManipulationContainer</a>. In events other than <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx">ManipulationStarting</a>, this property is read-only, so the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx">ManipulationStarting</a> event is the only time that you can set this property.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarted.aspx">ManipulationStarted</a> event occurs next. This event reports the origin of the manipulation.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> event occurs multiple times as a user&#8217;s fingers move on a touchscreen. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationdeltaeventargs.deltamanipulation.aspx">DeltaManipulation</a> property of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationdeltaeventargs.aspx">ManipulationDeltaEventArgs</a> class reports whether the manipulation is interpreted as movement, expansion, or translation. This is where you perform most of the work of manipulating an object.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx">ManipulationInertiaStarting</a> event occurs when the user&#8217;s fingers lose contact with the object. This event enables you to specify the deceleration of the manipulations during inertia. This is so your object can emulate different physical spaces or attributes if you choose. For example, suppose your application has two objects that represent items in the physical world, and one is heavier than the other. You can make the heavier object decelerate faster than the lighter object.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> event occurs multiple times as inertia occurs. Note that this event occurs when the user&#8217;s fingers move across the touchscreen and when WPF simulates inertia. In other words, <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> occurs before and after the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx">ManipulationInertiaStarting</a> event. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulationdeltaeventargs.isinertial.aspx">ManipulationDeltaEventArgs.IsInertial</a> property reports whether the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> event occurs during inertia, so you can check that property and perform different actions, depending on its value.</p>
</li>
<li>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationcompleted.aspx">ManipulationCompleted</a> event occurs when the manipulation and any inertia ends. That is, after all the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> events occur, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationcompleted.aspx">ManipulationCompleted</a> event occurs to signal that the manipulation is complete.</p>
</li>
</ol>
<h6>Boundary Feedback</h6>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> also defines the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback.aspx">ManipulationBoundaryFeedback</a> event. This event occurs when the <a href="http://msdn.microsoft.com/en-us/library/dd988680.aspx">ReportBoundaryFeedback</a> method is called in the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> event. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback.aspx">ManipulationBoundaryFeedback</a> event enables applications or components to provide visual feedback when an object hits a boundary. For example, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.window.aspx">Window</a> class handles the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback.aspx">ManipulationBoundaryFeedback</a> event to cause the window to slightly move when its edge is encountered.</p>
<h5>Mouse Promotion</h5>
<p>You can cancel the manipulation by calling the <a href="http://msdn.microsoft.com/en-us/library/ee792639.aspx">Cancel</a> method on the event arguments in any manipulation event except <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback.aspx">ManipulationBoundaryFeedback</a> event. When you call <a href="http://msdn.microsoft.com/en-us/library/ee792639.aspx">Cancel</a>, the manipulation events are no longer raised and mouse events occur for touch. The following table describes the relationship between the time the manipulation is canceled and the mouse events that occur.</p>
<p> <span style="text-align: ; widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; white-space: normal; orphans: 2; color: ; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="text-align: left; font-family: ; font-size: " class="Apple-style-span"><br />
<table style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; background-color: transparent; width: ; border-collapse: collapse; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; word-spacing: normal" width="595">
<tbody>
<tr style="vertical-align: top">
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="167" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">The event that Cancel is called in</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="426" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">The mouse events that occur for input that already occurred</font></p>
</th>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="167">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx"><font color="#1364c4" face="Segoe UI"></font><font style="font-size: " size="2">ManipulationStarting</font></a></span><font face="Segoe UI"></font><font style="font-size: "></font><font color="#000000"></font><font size="2"><span class="Apple-converted-space">&#160;</span>and</font></p>
<p><font face="Segoe UI"><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarted.aspx"><font style="font-size: " color="#1364c4" size="2">ManipulationStarted</font></a></span></font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="426">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Mouse down events.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="167">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">ManipulationDelta</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="426">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Mouse down and mouse move events.</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="167">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx"><font color="#1364c4" face="Segoe UI"></font><font style="font-size: " size="2">ManipulationInertiaStarting</font></a></span><font face="Segoe UI"></font><font style="font-size: "></font><font color="#000000"></font><font size="2"><span class="Apple-converted-space">&#160;</span>and</font></p>
<p><font face="Segoe UI"><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationcompleted.aspx"><font style="font-size: " color="#1364c4" size="2">ManipulationCompleted</font></a></span></font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="426">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Mouse down, mouse move, and mouse up events.</font></p>
</td>
</tr>
</tbody>
</table>
<p>   </span></span>
<p>Note that if you call <a href="http://msdn.microsoft.com/en-us/library/ee792639.aspx">Cancel</a> when the manipulation is in inertia, the method returns false and the input does not raise mouse events.</p>
<h5>The Relationship Between Touch and Manipulation Events</h5>
<p>A <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> can always receive touch events. When the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.ismanipulationenabled.aspx">IsManipulationEnabled</a> property is set to true, a <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a> can receive both touch and manipulation events. If the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown.aspx">TouchDown</a> event is not handled (that is, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.routedeventargs.handled.aspx">Handled</a> property is false), the manipulation logic captures the touch to the element and generates the manipulation events. If the <a href="http://msdn.microsoft.com/en-us/library/system.windows.routedeventargs.handled.aspx">Handled</a> property is set to true in the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown.aspx">TouchDown</a> event, the manipulation logic does not generate manipulation events. The following illustration shows the relationship between touch events and manipulation events.</p>
<p>Touch and manipulation events</p>
<p><img title="Relationship between touch and manipulation events" alt="Relationship between touch and manipulation events" src="http://i.msdn.microsoft.com/dynimg/IC392642.png" /></p>
<p>The following list describes the relationship between the touch and manipulation events that is shown in the preceding illustration.</p>
<ul>
<li>
<p>When the first touch device generates a <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown.aspx">TouchDown</a> event on a <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.aspx">UIElement</a>, the manipulation logic calls the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.capturetouch.aspx">CaptureTouch</a> method, which generates the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.gottouchcapture.aspx">GotTouchCapture</a> event.</p>
</li>
<li>
<p>When the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.gottouchcapture.aspx">GotTouchCapture</a> occurs, the manipulation logic calls the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.manipulation.addmanipulator.aspx">Manipulation.AddManipulator</a> method, which generates the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarting.aspx">ManipulationStarting</a> event.</p>
</li>
<li>
<p>When the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchmove.aspx">TouchMove</a> events occur, the manipulation logic generates the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta.aspx">ManipulationDelta</a> events that occur before the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx">ManipulationInertiaStarting</a> event.</p>
</li>
<li>
<p>When the last touch device on the element raises the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchup.aspx">TouchUp</a> event, the manipulation logic generates the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting.aspx">ManipulationInertiaStarting</a> event.</p>
</li>
</ul>
<ul>
<h5>
<ul>EventArgs Class Diagram</ul>
</h5>
<p> Below class diagram shows all the touch and manipulation EventArgs classes and relevant types. </ul>
<ul><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/WpfTouchEventArgs.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WPF Touch EventArgs Class Diagram" border="0" alt="WPF Touch EventArgs Class Diagram" src="http://www.ningzhang.org/wp-content/uploads/2010/10/WpfTouchEventArgs_thumb.png" width="604" height="310" /></a></ul>
<img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/caq07oWW0EM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/10/08/touch-support-in-wpf/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/10/08/touch-support-in-wpf/</feedburner:origLink></item>
		<item>
		<title>Silverlight Animation Class Diagram</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/ifxMqiMQ_Tk/</link>
		<comments>http://www.ningzhang.org/2010/10/03/silverlight-animation-class-diagram/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 05:16:57 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[animation]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/10/03/silverlight-animation-class-diagram/</guid>
		<description>The MSDN section Animation is a good overview on Silverlight animation. Below class diagram, summary and table can serve as quick reference. Diagram Summary Timeline is the base class of animation classes and Storyboard. It provides BeginTime, Duration, FillBehavior, RepeatBehavior, AutoReverse etc. dependent properties, and Completed event. Storyboard is a collection of Timelines, including animations [...]</description>
			<content:encoded><![CDATA[<p>The MSDN section <a href="http://msdn.microsoft.com/en-us/library/cc189090(v=VS.95).aspx">Animation</a> is a good overview on Silverlight animation. Below class diagram, summary and table can serve as quick reference.</p>
<p><strong><font size="2">Diagram</font></strong></p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/Animation.png" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Silverlight Animation Class Diagram" border="0" alt="Silverlight Animation Class Diagram" src="http://www.ningzhang.org/wp-content/uploads/2010/10/Animation_thumb.png" width="604" height="278" /></a></p>
<p><strong><font size="2">Summary</font></strong></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline(VS.95).aspx" target="_blank">Timeline</a> is the base class of animation classes and Storyboard. It provides <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.begintime(v=VS.95).aspx" target="_blank">BeginTime</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.duration(v=VS.95).aspx" target="_blank">Duration</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.fillbehavior(v=VS.95).aspx" target="_blank">FillBehavior</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.repeatbehavior(v=VS.95).aspx" target="_blank">RepeatBehavior</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.autoreverse(v=VS.95).aspx" target="_blank">AutoReverse</a> etc. dependent properties, and <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.completed(v=VS.95).aspx" target="_blank">Completed</a> event. </li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.storyboard(v=VS.95).aspx" target="_blank">Storyboard</a> is a collection of Timelines, including animations and storyboards. It provides <a href="http://msdn.microsoft.com/en-us/library/cc190590(v=VS.95).aspx" target="_blank">Begin</a>, <a href="http://msdn.microsoft.com/en-us/library/cc190749(v=VS.95).aspx" target="_blank">Stop</a>, <a href="http://msdn.microsoft.com/en-us/library/cc190455(v=VS.95).aspx" target="_blank">Pause</a>, <a href="http://msdn.microsoft.com/en-us/library/cc190437(v=VS.95).aspx" target="_blank">Resume</a> etc. methods, and <a href="http://msdn.microsoft.com/en-us/library/cc190580(v=VS.95).aspx" target="_blank">TargetName</a> and <a href="http://msdn.microsoft.com/en-us/library/cc672995(v=VS.95).aspx" target="_blank">TargetProperty</a> attached properties. </li>
<li>Basic animations: [<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation(v=VS.95).aspx" target="_blank">Double</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.pointanimation(v=VS.95).aspx" target="_blank">Point</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.coloranimation(v=VS.95).aspx" target="_blank">Color</a>]Animation classes animate correspondingly typed dependent properties between two values specified by From, To, By properties. They use EasingFunction property to animate changes non-linearly:
<ul>
<li>Easing functions: Silverlight provides 11 easing function classes ([<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.backease(v=VS.95).aspx" target="_blank">Back</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.bounceease(v=VS.95).aspx" target="_blank">Bounce</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.circleease(v=VS.95).aspx" target="_blank">Circle</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.cubicease(v=VS.95).aspx" target="_blank">Cubic</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.elasticease(v=VS.95).aspx" target="_blank">Elastic</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.exponentialease(v=VS.95).aspx" target="_blank">Exponential</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.powerease(v=VS.95).aspx" target="_blank">Power</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.quadraticease(v=VS.95).aspx" target="_blank">Quadratic</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.quarticease(v=VS.95).aspx" target="_blank">Quartic</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.quinticease(v=VS.95).aspx" target="_blank">Quintic</a>|<a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.sineease(v=VS.95).aspx" target="_blank">Sine</a>]Ease), all subclass of <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.easingfunctionbase(v=VS.95).aspx" target="_blank">EasingFunctionBase</a>, which provides dependent property <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.easingfunctionbase.easingmode(v=VS.95).aspx" target="_blank">EasingMode</a>.&#160; </li>
</ul>
</li>
<li>Key-frame animation: key-frame animations support animating through a collection of key frames, each with KeyTime and Value properties. They also support multiple interpolation methods between key frames: discrete, easing, linear, spline. So there are 13 key frame classes: [Discrete|Easing|Linear|Spline][Double|Point|Color]KeyFrame and <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.objectkeyframe(v=VS.95).aspx" target="_blank">ObjectKeyFrame</a>. </li>
</ul>
<p><strong><font size="2">Table</font></strong></p>
<table style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; background-color: transparent; width: ; border-collapse: collapse; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; word-spacing: normal" width="596">
<tbody>
<tr style="vertical-align: top">
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="63" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Property type</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="98" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Basic (From/To/By) animation</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="190" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Key-frame animation</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="187" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Usage example</font></p>
</th>
<th style="border-bottom: rgb(187,187,187) 1px solid; text-align: ; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; background-color: rgb(229,229,229); font-style: ; padding-left: 4px; padding-right: 4px; font-family: ; height: ; color: ; font-size: ; border-top: rgb(187,187,187) 1px solid; font-weight: ; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="10" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Interpolation methods supported</font></p>
</th>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="64">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.color(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">Color</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="98">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.coloranimation(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">ColorAnimation</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="190">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.coloranimationusingkeyframes(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">ColorAnimation-UsingKeyFrames</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="187">
<p><font face="Segoe UI"></font><font size="2"></font><font color="#000000"></font><font style="font-size: ">Animate the<span class="Apple-converted-space">&#160;</span></font><font style="font-size: "><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.color(v=VS.95).aspx"><font color="#1364c4">Color</font></a></span></font><font color="#000000"><span class="Apple-converted-space">&#160;</span>of a<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.solidcolorbrush(v=VS.95).aspx"><font color="#1364c4">SolidColorBrush</font></a></span><font color="#000000"><span class="Apple-converted-space">&#160;</span>or a<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.gradientstop(v=VS.95).aspx"><font color="#1364c4">GradientStop</font></a></span><font color="#000000">.</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; font-family: ; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="10" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Discrete, Linear, Splined</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="64">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.double(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">Double</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="98">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">DoubleAnimation</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="190">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimationusingkeyframes(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">DoubleAnimation-UsingKeyFrames</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="187">
<p><font face="Segoe UI"></font><font size="2"></font><font color="#000000"></font><font style="font-size: ">Animate the<span class="Apple-converted-space">&#160;</span></font><font style="font-size: "><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.width(v=VS.95).aspx"><font color="#1364c4">Width</font></a></span></font><font color="#000000"><span class="Apple-converted-space">&#160;</span>of a<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.shapes.rectangle(v=VS.95).aspx"><font color="#1364c4">Rectangle</font></a></span><font color="#000000"><span class="Apple-converted-space">&#160;</span>or the<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.height(v=VS.95).aspx"><font color="#1364c4">Height</font></a></span><font color="#000000"><span class="Apple-converted-space">&#160;</span>of an<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.shapes.ellipse(v=VS.95).aspx"><font color="#1364c4">Ellipse</font></a></span><font color="#000000"><span class="Apple-converted-space">&#160;</span>(or any </font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement(v=VS.95).aspx"><font color="#1364c4">FrameworkElement</font></a></span><font color="#000000">)</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; font-family: ; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="10" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Discrete, Linear, Splined</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="64">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.point(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">Point</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="98">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.pointanimation(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">PointAnimation</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="190">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.pointanimationusingkeyframes(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">PointAnimation-UsingKeyFrames</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="187">
<p><font face="Segoe UI"></font><font size="2"></font><font color="#000000"></font><font style="font-size: ">Animate the<span class="Apple-converted-space">&#160;</span></font><font style="font-size: "><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.ellipsegeometry.center(v=VS.95).aspx"><font color="#1364c4">Center</font></a></span></font><font color="#000000"><span class="Apple-converted-space">&#160;</span>position of an<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.ellipsegeometry(v=VS.95).aspx"><font color="#1364c4">EllipseGeometry</font></a></span><font color="#000000">.</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; font-family: ; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="10" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Discrete, Linear, Splined</font></p>
</td>
</tr>
<tr style="vertical-align: top">
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="64">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.object(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">Object</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="98">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">None</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="190">
<p><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.objectanimationusingkeyframes(v=VS.95).aspx"><font face="Segoe UI"></font><font style="font-size: " color="#1364c4" size="2">ObjectAnimation-UsingKeyFrames</font></a></span></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; line-height: 18px; background-color: rgb(255,255,255); margin: 1px; padding-left: 4px; padding-right: 4px; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" width="187">
<p><font face="Segoe UI"></font><font size="2"></font><font color="#000000"></font><font style="font-size: ">Animate the<span class="Apple-converted-space">&#160;</span></font><font style="font-size: "><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape.fill(v=VS.95).aspx"><font color="#1364c4">Fill</font></a></span></font><font color="#000000"><span class="Apple-converted-space">&#160;</span>property from one<span class="Apple-converted-space">&#160;</span></font><span><a style="color: ; text-decoration: " href="http://msdn.microsoft.com/en-us/library/system.windows.media.gradientbrush(v=VS.95).aspx"><font color="#1364c4">GradientBrush</font></a></span><font color="#000000"><span class="Apple-converted-space">&#160;</span>to another.</font></p>
</td>
<td style="border-bottom: rgb(187,187,187) 1px solid; border-left: rgb(187,187,187) 1px solid; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; font-family: ; border-top: rgb(187,187,187) 1px solid; border-right: rgb(187,187,187) 1px solid; padding-top: 4px" height="21" width="10" align="left">
<p><font face="Segoe UI"></font><font style="font-size: " color="#000000" size="2">Discrete</font></p>
</td>
</tr>
</tbody>
</table>
<img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/ifxMqiMQ_Tk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/10/03/silverlight-animation-class-diagram/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/10/03/silverlight-animation-class-diagram/</feedburner:origLink></item>
		<item>
		<title>Fix WP7 Dev Tools Install Issue: Setup cannot be run in Program Compatibility Mode</title>
		<link>http://feeds.ningzhang.org/~r/NingZhangsBlog/~3/hwn33cAoYj0/</link>
		<comments>http://www.ningzhang.org/2010/10/03/fix-wp7-dev-tools-install-issue-setup-cannot-be-run-in-program-compatibility-mode/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 22:59:31 +0000</pubDate>
		<dc:creator>Ning Zhang</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.ningzhang.org/2010/10/03/fix-wp7-dev-tools-install-issue-setup-cannot-be-run-in-program-compatibility-mode/</guid>
		<description>I had VS2010 running while installing developer tools for Windows Phone 7, so I had to exit setup, close VS2010, and rerun vm_web.exe. But it gave following error: Visual Studio setup cannot run in compatibility mode. For more information see the &amp;#8216;Installing&amp;#8217; section in the Visual Studio Readme at &amp;#34;http://go.microsoft.com/fwlink/?LinkId=143397&amp;#34;. After searching the Internet and [...]</description>
			<content:encoded><![CDATA[<p>I had VS2010 running while installing <a href="http://developer.windowsphone.com/windows-phone-7/" target="_blank">developer tools for Windows Phone 7</a>, so I had to exit setup, close VS2010, and rerun vm_web.exe. But it gave following error:</p>
<blockquote><p>Visual Studio setup cannot run in compatibility mode. For more information see the &#8216;Installing&#8217; section in the Visual Studio Readme at &quot;<a href="http://go.microsoft.com/fwlink/?LinkId=143397%22">http://go.microsoft.com/fwlink/?LinkId=143397&quot;</a>.</p>
</blockquote>
<p>After searching the Internet and tried a few things, what worked for me is to <strong>un</strong>check “Run this program in compatibility mode” in vm_web.exe’s Properties dialog:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/image.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="vm_web.exe properties dialog" border="0" alt="vm_web.exe properties dialog" src="http://www.ningzhang.org/wp-content/uploads/2010/10/image_thumb.png" width="358" height="454" /></a></p>
<p>If the checkbox is checked and grayed out, click “Change settings for all users” button at the bottom of the dialog, and then <strong>un</strong>check “Run this program in compatibility mode” in the popped up “Compatibility for all users” dialog:</p>
<p><a href="http://www.ningzhang.org/wp-content/uploads/2010/10/image1.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="vm_web.exe compatibility for all users dialog" border="0" alt="vm_web.exe compatibility for all users dialog" src="http://www.ningzhang.org/wp-content/uploads/2010/10/image_thumb1.png" width="348" height="454" /></a></p>
<p>After that, rerun vm_web.exe and it should succeed. </p>
<p>Below is relevant section in Visual Studio readme at <a href="http://go.microsoft.com/fwlink/?LinkId=143397">http://go.microsoft.com/fwlink/?LinkId=143397</a>. I removed the registry entry for vm_web.exe and VS2010’s setup.exe, but not sure whether it helped or not. </p>
<blockquote><h6>2.1.10 Visual Studio Setup cannot be run in Program Compatibility Mode</h6>
<p>Visual Studio 2010 and/or the .NET Framework 4 Setup fails with 1603 error code or blocks running in Program Compatibility Mode.</p>
<p>Windows Program Compatibility Assistant indicates that Visual Studio Setup might not have installed correctly, and prompts the user to reinstall by using the recommended setting (program compatibility mode).</p>
<p><u>To resolve this issue:</u></p>
<p>Visual Studio Setup cannot run in program compatibility mode.&#160; Ensure that the compatibility mode setting is not enabled system-wide or for the Visual Studio Setup application.</p>
<p><b>Check the manual setting</b></p>
<p>Compatibility mode could have been set manually on the Compatibility tab on the executable file properties.</p>
<ol>
<li>On the Visual Studio Setup media, locate setup.exe. </li>
<li>Right-click setup.exe and then click Properties. </li>
<li>On the Compatibility tab, clear &quot;Run this program in compatibility mode for&quot; and then then click OK.</li>
</ol>
<p><b>Check Program Compatibility Assistant registry settings</b></p>
<p>Compatibility mode could have been set by Program Compatibility Assistant on earlier failed or canceled attempts to run Visual Studio setup.exe.</p>
<ol>
<li>Click Start, and then click Run. </li>
<li>Type <i>regedit</i>, and then click OK. </li>
<li>Browse to each of the following keys and delete any value that refers to setup.exe in the Visual Studio install path:
<ul>
<li><i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted</i></li>
<li><i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers</i></li>
</ul>
</li>
</ol>
<p><b>Rerun Visual Studio Setup</b></p>
<ol>
<li>Open Windows Explorer. </li>
<li>Browse to Visual Studio setup.exe. </li>
<li>Double-click setup.exe to run Visual Studio Setup.</li>
</ol>
<p><b>Related KB Article</b></p>
<p><a href="http://support.microsoft.com/kb/931709">http://support.microsoft.com/kb/931709</a></p>
<p><b>Another Workaround:</b></p>
<p>Instead of executing the &lt;DVD ROOT&gt;\setup.exe, execute &lt;DVD ROOT&gt;\setup\setup.exe</p>
</blockquote>
<img src="http://feeds.feedburner.com/~r/NingZhangsBlog/~4/hwn33cAoYj0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ningzhang.org/2010/10/03/fix-wp7-dev-tools-install-issue-setup-cannot-be-run-in-program-compatibility-mode/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2010/10/03/fix-wp7-dev-tools-install-issue-setup-cannot-be-run-in-program-compatibility-mode/</feedburner:origLink></item>
		<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: On Mac, make sure /Library/Internet Plug-Ins/Silverlight.plugin [...]</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>
<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>13</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 [...]</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>
<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 [...]</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>
<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 [...]</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>
<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>13</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: Controls with FlowDirection set to RightToLeft: For those [...]</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>
<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>5</slash:comments>
		<feedburner:origLink>http://www.ningzhang.org/2009/11/18/silverlight-4-adds-arabic-support/</feedburner:origLink></item>
	</channel>
</rss>

