<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5641045166738036061</atom:id><lastBuildDate>Wed, 28 Aug 2024 07:47:31 +0000</lastBuildDate><category>Silverlight</category><category>WPF</category><category>Triggers</category><category>XAML</category><category>Assemblies</category><category>Data Binding</category><category>Debug</category><category>Namespaces</category><category>Templates</category><category>Tip</category><category>Training</category><category>Animation</category><category>Dependency Properties</category><category>On-Demand</category><category>Resource Files</category><category>Silverlight Spy</category><category>Silverlight Streaming</category><category>Silverlight; Styles</category><category>Snoop</category><title>Jim Mangaly&#39;s Blog</title><description></description><link>http://jimmangaly.blogspot.com/</link><managingEditor>noreply@blogger.com (Jim Mangaly)</managingEditor><generator>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-1768902242136171172</guid><pubDate>Wed, 27 May 2009 08:38:00 +0000</pubDate><atom:updated>2009-05-27T02:04:27.348-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Debug</category><category domain="http://www.blogger.com/atom/ns#">Dependency Properties</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>Why doesn’t my WPF Trigger work? (... a peek into the Dependency Property evaluation process)</title><description>&lt;p&gt;Imagine a simple situation where I have a blue rectangle:&lt;/p&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;BORDER-RIGHT: silver 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: silver 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: silver 1px solid; WIDTH: 97.5%; CURSOR: text; DIRECTION: ltr; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: silver 1px solid; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; DIRECTION: ltr; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Rectangle&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;200&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;300&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Fill&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Blue&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;Now when I do a mouse over the rectangle, I want the color to turn to red - simple! The obvious choice in WPF is to add a property trigger. So that’s what I do.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;BORDER-RIGHT: silver 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: silver 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: silver 1px solid; WIDTH: 97.5%; CURSOR: text; DIRECTION: ltr; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: silver 1px solid; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;br /&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; DIRECTION: ltr; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid.Resources&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;TargetType&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Rectangle&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;rectStyle&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style.Triggers&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Trigger&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Property&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;IsMouseOver&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;True&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;          &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Setter&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Property&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Fill&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Red&quot;&lt;/span&gt; &lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Trigger&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style.Triggers&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid.Resources&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Rectangle&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;200&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;300&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Fill&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Blue&quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style=&quot;color:#ff0000;&quot;&gt;Style&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;{StaticResource rectStyle}&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;But it doesn’t work! What could be wrong? Perhaps the mouse over event isn’t firing on the rectangle for some reason? I debug the trigger using &lt;a href=&quot;http://www.wpfmentor.com/2009/01/how-to-debug-triggers-using-trigger.html&quot;&gt;this cool technique&lt;/a&gt; and find that the trigger is firing alright. Then what on earth is the problem?&lt;/p&gt;&lt;p&gt;A closer look reveals the real issue. The culprit was the Fill=&quot;Blue&quot; assignment! When evaluating the value of a dependency property, the dependency property system takes into consideration a few factors. The whole dependency property value evaluation process is shown below. Certain factors have priority over others as shown in Step 1 below.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Determine Base Value&lt;br /&gt;In the order of diminishing priority:&lt;br /&gt;(a) Local Value&lt;br /&gt;(b) Style triggers&lt;br /&gt;(c) Template Triggers&lt;br /&gt;(d) Style Setters&lt;br /&gt;(e) Theme Style Triggers&lt;br /&gt;(f) Theme Style Setters&lt;br /&gt;(g) Inheritance&lt;br /&gt;(h) Default Value&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Evaluate&lt;br /&gt;– If Step 1 returns expression (DataBinding or DynamicResource), evaluate &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Apply Animation&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Coerce&lt;br /&gt;- If CoerceValueCallback defined&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;: Validate&lt;br /&gt;- If ValidateValueCallback defined&lt;/p&gt;&lt;p&gt;In the above example of the rectangle, the trigger (see Step 1b) that I set in the style, had lower priority when compared to the local value (see Step 1a), that is the Fill=&quot;Blue&quot; assignment. That was the reason why the trigger value was ignored. So the result/output of Step 1 as far as the Fill property was concerned was the local value “Blue”. In this example, Steps 2-5 do not apply.&lt;/p&gt;&lt;p&gt;So how do I get my trigger to work? If I remove the local value assignment for Fill, and instead set that value within the style, then everything will work as expected because triggers (see Step 1b) have higher priority over style setters (see Step 1d).&lt;br /&gt;&lt;/p&gt;&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;BORDER-RIGHT: silver 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: silver 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: silver 1px solid; WIDTH: 97.5%; CURSOR: text; DIRECTION: ltr; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: silver 1px solid; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;br /&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; DIRECTION: ltr; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none; BACKGROUND-: leftfont-family:&#39;Courier New&#39;, courier, monospace;font-size:8pt;color:#f4f4f4;&quot;   &gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid.Resources&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;TargetType&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Rectangle&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;rectStyle&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Setter&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Property&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Fill&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Blue&quot;&lt;/span&gt; &lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style.Triggers&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Trigger&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Property&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;IsMouseOver&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;True&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;          &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Setter&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Property&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Fill&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;Red&quot;&lt;/span&gt; &lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Trigger&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style.Triggers&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Style&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid.Resources&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Rectangle&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;200&quot;&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;300&quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style=&quot;color:#ff0000;&quot;&gt;Style&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;=&quot;{StaticResource rectStyle}&quot;&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#800000;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color:#0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Now the trigger works as expected!&lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2009/05/why-doesnt-my-wpf-trigger-work.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-922392199025031988</guid><pubDate>Mon, 27 Apr 2009 07:14:00 +0000</pubDate><atom:updated>2009-05-29T02:35:55.474-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Animation</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>WPF Text to Animated Path</title><description>Not sure what to call this - slate control? Or Text Scribbler? May be, or perhaps just &quot;text to animated path control&quot; :). Anyway, I was playing around with the possibility of animating text in such a way that you can see the text being written as though with a pen or a piece of chalk. This is the end result...&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbeII6g3cad5jmAcUtpAFhyphenhyphenzJaRbt5YN67PwphbXd15aTkhLslJJ7pbcqJIV-2j8t27yPFR52UAkrD48wZV_q8QTfkjeeHpAyI1H5-NIjMSeY3effX4S7y0gP1XZRz5Q8fXeKXKyRDhyhS/s1600-h/TextToPath.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5329283705736173458&quot; style=&quot;WIDTH: 400px; CURSOR: pointer; HEIGHT: 266px&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbeII6g3cad5jmAcUtpAFhyphenhyphenzJaRbt5YN67PwphbXd15aTkhLslJJ7pbcqJIV-2j8t27yPFR52UAkrD48wZV_q8QTfkjeeHpAyI1H5-NIjMSeY3effX4S7y0gP1XZRz5Q8fXeKXKyRDhyhS/s400/TextToPath.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;You can get the source &lt;a href=&quot;http://cid-805d5a2665b423de.skydrive.live.com/self.aspx/Public/TextToAnimatedPath.zip&quot;&gt;here&lt;/a&gt;. Just run the application, enter any text in the TextBox, and hit the button to see the text being scribbled down in an animated fashion. You can also choose the Font Family, and the Foreground of the text from the combo boxes.&lt;br /&gt;&lt;br /&gt;This is what the application does when the button is clicked:&lt;br /&gt;1) The text from the TextBox is converted into a PathGeometry using the FormattedText class (System.Windows.Media namespace). You can specify the Font Family, Font Size etc. and get the corresponding path.&lt;br /&gt;&lt;br /&gt;2) A MatrixAnimationUsingPath is applied on the pen (the red color object in the screen shot above). The PathGeometry property of this animation is set to the value obtained from Step 1).&lt;br /&gt;&lt;br /&gt;3) At this point, the pen will animate over the path, but nothing will be scribbled down. While the pen is being animated, a timer runs concurrently with an interval in milliseconds. Whenever the timer ticks, the current position of the pen is calculated, and a small dot (ellipse) is drawn at that point. This gives you the illusion of text being continuously written down with the pen.&lt;br /&gt;&lt;br /&gt;That&#39;s it! Enjoy scribbling!&lt;br /&gt;&lt;br /&gt;(Note: The sample supports multi-line scribbling as well. To test this out, just set AcceptsReturn to true on the TextBox (you may also need to set IsDefault to False on the Start Button so that it does not interfere with the return key meant for the TextBox). Now if you enter multiple lines within the TextBox and start scribbling, you get multi-line scribbling !)&lt;br /&gt;&lt;br /&gt;Source: Get it &lt;a href=&quot;http://cid-805d5a2665b423de.skydrive.live.com/self.aspx/Public/TextToAnimatedPath.zip&quot;&gt;here&lt;/a&gt;.</description><link>http://jimmangaly.blogspot.com/2009/04/wpf-text-to-animated-path.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbeII6g3cad5jmAcUtpAFhyphenhyphenzJaRbt5YN67PwphbXd15aTkhLslJJ7pbcqJIV-2j8t27yPFR52UAkrD48wZV_q8QTfkjeeHpAyI1H5-NIjMSeY3effX4S7y0gP1XZRz5Q8fXeKXKyRDhyhS/s72-c/TextToPath.jpg" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-4107351458848921675</guid><pubDate>Fri, 24 Apr 2009 06:35:00 +0000</pubDate><atom:updated>2009-04-24T00:47:52.155-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Data Binding</category><category domain="http://www.blogger.com/atom/ns#">Debug</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>Debugging Data Binding in WPF</title><description>&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;What do you do when you suspect that a data binding is broken in your WPF application? Looking at the Output window for data binding exceptions can be helpful in many cases. However, there are cases where this does not help.&lt;br /&gt;&lt;br /&gt;For example, below I have TextBox.Text bound to Slider.Value. But notice that the binding is OneWay.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBox&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Binding&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; ElementName&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=slider,&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Path&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=Value,&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Mode&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=OneWay}&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Height&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;30&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Width&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;100&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Margin&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;10&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Slider&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Minimum&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Maximum&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;100&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Value&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;20&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Margin&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;10&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; x&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;Name&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;slider&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;When I move the slider, the text in the TextBox shows the slider value as expected. Now I enter some text in the TextBox(which causes the binding to break since it is OneWay binding; but assume that I haven&#39;t realized that). I move the slider now, but the text in TextBox does not update. I suspect that the binding is broken. But how do I confirm that?&lt;br /&gt;&lt;br /&gt;Simply looking at the Output Window in this case reveals nothing. What I&#39;ve been doing until now is to add a dummy converter and set a break point in the Convert method. If the break point is not hit I know that the binding is broken. But that is really a long way of doing something that should be really done in a simpler way....&lt;br /&gt;&lt;br /&gt;WPF 3.5 has a new property called PresentationTraceSources.TraceLevel that you can set on your data binding to get more detailed information on the binding in the Output Window. In fact, if you set the trace level to High you can get details on every step in the process of the binding.&lt;br /&gt;&lt;br /&gt;So to the above code, I make two changes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;Add a namespace reference to System.Diagnostics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;Set PresentationTraceSources.TraceLevel=High on the      binding I want to inspect.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Window&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; x&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;Class&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;DebugBindings.Window1&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;... xmlns&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;trace&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;clr-namespace:System.Diagnostics;assembly=WindowsBase&quot;&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StackPanel&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBox&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Binding&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; ElementName&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=slider,&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Path&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=Value,&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Mode&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=OneWay,&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; trace&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;PresentationTraceSources&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;.TraceLevel=High}&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Height&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;30&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Width&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;100&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Margin&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;10&quot;/&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Slider&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Minimum&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Maximum&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;100&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Value&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;20&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Margin&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;10&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; x&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;Name&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;slider&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StackPanel&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Window&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;Now when I inspect the Output Window after running the application, I can see step-by-step details of the data binding process.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;Created BindingExpression (hash=17654054) for Binding (hash=44624228)&lt;br /&gt;Path: &#39;Value&#39;&lt;br /&gt;BindingExpression (hash=17654054): Default update trigger resolved to LostFocus&lt;br /&gt;BindingExpression (hash=17654054): Attach to System.Windows.Controls.TextBox.Text (hash=52727599)&lt;br /&gt;BindingExpression (hash=17654054): Resolving source&lt;br /&gt;BindingExpression (hash=17654054): Found data context element: (OK)&lt;br /&gt;Lookup name slider: queried TextBox (hash=52727599)&lt;br /&gt;BindingExpression (hash=17654054): Resolve source deferred&lt;/span&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;BindingExpression (hash=17654054): Resolving source&lt;br /&gt;BindingExpression (hash=17654054): Found data context element: (OK)&lt;br /&gt;Lookup name slider: queried TextBox (hash=52727599)&lt;br /&gt;BindingExpression (hash=17654054): Activate with root item Slider (hash=54371668)&lt;br /&gt;BindingExpression (hash=17654054): At level 0 - for Slider.Value found accessor DependencyProperty(Value)&lt;br /&gt;BindingExpression (hash=17654054): Replace item at level 0 with Slider (hash=54371668), using accessor DependencyProperty(Value)&lt;br /&gt;BindingExpression (hash=17654054): GetValue at level 0 from Slider (hash=54371668) using DependencyProperty(Value): &#39;20&#39;&lt;br /&gt;BindingExpression (hash=17654054): TransferValue - got raw value &#39;20&#39;&lt;br /&gt;BindingExpression (hash=17654054): TransferValue - implicit converter produced &#39;20&#39;&lt;br /&gt;BindingExpression (hash=17654054): TransferValue - using final value &#39;20&#39;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;&quot;&gt;If I now enter text in the TextBox, I can check the Output Window to confirm that the binding was indeed broken!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;BindingExpression (hash=17654054): Deactivate&lt;br /&gt;BindingExpression (hash=17654054): Replace item at level 0 with {NullDataItem}&lt;br /&gt;BindingExpression (hash=17654054): Detach&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt; The only down side is that you have to manually add this property to each binding that you want to inspect.&lt;/span&gt;&lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2009/04/debugging-data-binding-in-wpf.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-1642520543301720201</guid><pubDate>Mon, 29 Dec 2008 10:35:00 +0000</pubDate><atom:updated>2011-04-13T05:12:40.063-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>Discovering RelativeSource.PreviousData</title><description>When working with Data Binding in WPF, I have found the RelativeSource class very useful. This class is useful when you want to bind to a source relative to the binding target. For example you may want to bind the Width of a control to its Height. In this case RelativeSource.Self can be used. Or you may want to bind to an element that is an ancestor of the binding target. Here you would use RelativeSource.FindAncestor. &lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;But there was another use of RelativeSource that I was not aware of until recently - RelativeSource.PreviousData. Let me explain where this might be useful. Say you have data bound an ItemsControl like a ListBox to a collection of data items. You have written a DataTemplate to define how each item must be displayed within the ItemsControl. Within the DataTemplate you have access to the current data item. But what if you also want access to the previous data item?&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;For example, you may be displaying the stock values for a company as a chart as shown below.&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC_HANNeb0fj82PyPBFC4ysJIgCNySk69Snta77aMIik173IBAUd09ykH7cXELbmotbul1y7PiGpqWr_YZp-MGqbJviRcLAnllsLYJuf2IEIOPztXL6QEQDfoadtk1oTYuN0a_Njl4KKLx/s1600-h/Chart.jpg&quot;&gt;&lt;img style=&quot;WIDTH: 449px; HEIGHT: 290px; CURSOR: pointer&quot; id=&quot;BLOGGER_PHOTO_ID_5285177129955592754&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC_HANNeb0fj82PyPBFC4ysJIgCNySk69Snta77aMIik173IBAUd09ykH7cXELbmotbul1y7PiGpqWr_YZp-MGqbJviRcLAnllsLYJuf2IEIOPztXL6QEQDfoadtk1oTYuN0a_Njl4KKLx/s400/Chart.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Each bar in the chart represents one data item within the ItemsControl. But within each item(above the bar), you also want to show the increase/decrease of the stock value when compared to the previous stock value. This is where RelativeSource.PreviousData is useful as shown below.&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;DataTemplate&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt;Key&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;=&quot;RecordTemplate&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;...........&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;...........&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; Margin&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;=&quot;3,0,0,3&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 1in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;TextBlock.Text&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 1.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;MultiBinding&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; Converter&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;StaticResource&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; RecordsDifferenceConverter&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;}&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 2in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;Binding&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 2in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;Binding&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; RelativeSource&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;RelativeSource&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:red;&quot;&gt; PreviousData&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;}&quot;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 1.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;MultiBinding&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 1in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;TextBlock.Text&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;...........&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;...........&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;&quot; &gt;/ DataTemplate&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;color:blue;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;In the above XAML snippet, the MultiValueConverter accepts the value of the current item and the value of the previous item, and returns the difference between the two. This is displayed above each bar in the chart. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;The source code for this sample may be found &lt;a href=&quot;http://cid-805d5a2665b423de.office.live.com/self.aspx/Public/RelativeSource%5E_PreviousData.zip&quot;&gt;here&lt;/a&gt;. Keep in mind that this is not a fully implemented chart – there are so many things missing. I just wanted to illustrate where RelativeSource.PreviousData may be useful.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2008/12/discovering-relativesourcepreviousdata.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC_HANNeb0fj82PyPBFC4ysJIgCNySk69Snta77aMIik173IBAUd09ykH7cXELbmotbul1y7PiGpqWr_YZp-MGqbJviRcLAnllsLYJuf2IEIOPztXL6QEQDfoadtk1oTYuN0a_Njl4KKLx/s72-c/Chart.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-3054891063834859226</guid><pubDate>Wed, 29 Oct 2008 10:49:00 +0000</pubDate><atom:updated>2008-10-30T22:10:08.364-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight; Styles</category><title>Implicit Styles in Silverlight</title><description>&lt;div&gt;WPF supports both explicit and implicit styles (application wide styles), while Silverlight supports only explicit styles. This means that in Silverlight when you define a style as a resource, you have to give it an explicit key, and call that key wherever you want the style to be applied. For example, if you have defined a TextBlock style in App.Resources, you have to explicity set the Style property on all TextBlocks within the application like this:&lt;/div&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;line-height: 115%; color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Text1&quot;&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Style&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;line-height: 115%; color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StaticResource&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:red;&quot;   &gt; key1&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;}&quot;/&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Text2&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Style&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StaticResource&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; key1&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;}&quot;/&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Text3&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Style&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StaticResource&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; key1&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;}&quot;/&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;This has been an issue Silverlight developers have been grappling with for a long time. The Silverlight 2 release (RTW) did not have a solution for this. Fortunately, the &lt;a href=&quot;http://www.codeplex.com/Silverlight&quot;&gt;Silverlight Toolkit &lt;/a&gt;that has been released yesterday, comes with an ImplicitStyleManager that makes implicit styles possible in Silverlight. If you are not familiar with the Silverlight Toolkit, you can read about it &lt;a href=&quot;http://www.codeplex.com/Silverlight&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;So, how do you make use of this?&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href=&quot;http://www.codeplex.com/Silverlight/Release/ProjectReleases.aspx&quot;&gt;1) Download &lt;/a&gt;the Silverlight Toolkit.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;2) Copy Microsoft.Windows.Controls.Theming.dll that comes within the toolkit to your Silverlight project and add a reference to it.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;3) Add a reference to the namespace within which the ImplicitStyleManager resides:&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:red;&quot;   &gt;xmlns&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:red;&quot;   &gt;theming&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;clr-namespace:Microsoft.Windows.Controls.Theming; assembly=Microsoft.Windows.Controls.Theming&quot;&lt;/span&gt;&lt;/p&gt;  &lt;/div&gt;&lt;br /&gt;&lt;div&gt;4) Now use the ApplyMode property to set implicit styling:&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StackPanel&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; x&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt;Name&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;stackPanel&quot; &lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:Consolas;font-size:10;color:red;&quot;   &gt;theming&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:Consolas;font-size:10;color:red;&quot;   &gt;ImplicitStyleManager.ApplyMode&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;=&quot;OneTime&quot;&lt;/span&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Static Text 1&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Text&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Static Text 2&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;line-height: 115%; color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;line-height: 115%; color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;StackPanel&lt;/span&gt;&lt;span style=&quot;line-height: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;5) Of course, you should have defined the style somewhere in the resources collection as shown below:&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Style&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; TargetType&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;TextBlock&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Setter&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Property&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Foreground&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Value&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Red&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Setter&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Property&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;FontSize&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Value&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;20&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Setter&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Property&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;Margin&quot;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:red;&quot;   &gt; Value&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;=&quot;5&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Style&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; line-height: normal;&quot;&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:Consolas;font-size:10;&quot;  &gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;Now you are good to go. The ImplicitStyleManager will ensure that the style is passed down to the TextBlock down the element tree.&lt;br /&gt;&lt;br /&gt;If you dynamically add a TextBlock to the element tree (at run time), you will find that the TextBlock will not get the style. In this case, you will have to set &lt;span style=&quot;font-weight: bold;font-family:Consolas;font-size:10;color:red;&quot;   &gt;ImplicitStyleManager.ApplyMode&lt;/span&gt;&lt;span style=&quot;;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;=&quot;Auto&quot;. &lt;/span&gt;&lt;/span&gt;But  setting it to Auto can have a major performance impact, so use this sparingly.&lt;br /&gt;&lt;br /&gt;There you go - implicit styles in Silverlight :).&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;</description><link>http://jimmangaly.blogspot.com/2008/10/implicit-styles-in-silverlight.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-1536941266084699007</guid><pubDate>Sat, 27 Sep 2008 11:03:00 +0000</pubDate><atom:updated>2008-09-27T04:23:55.708-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Silverlight 2 RCO is Out</title><description>Silverlight 2 RCO &lt;a href=&quot;http://silverlight.net/GetStarted/sl2rc0.aspx&quot;&gt;is Out&lt;/a&gt;! So that means that the Silverlight RTW (Release To Web) is round the corner. The RCO release is a developer-only runtime edition that will help developers to prepare their existing Silverlight 2 Beta 2 applications for the final release. Some points to note:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;This RCO release is feature complete - so do not expect any more controls/features in the Silverlight 2 release. However &lt;a href=&quot;http://blogs.msdn.com/sburke/archive/2008/09/17/control-freak.aspx&quot;&gt;more controls/features &lt;/a&gt;can be expected in future months to be built on top of Silverlight 2 (these will not be part of the core runtime).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Three new controls added - ComboBox, ProgressBar, and PasswordBox. These along with most other controls will be part of the Silverlight runtime (which means that these will not be needed to be downloaded with the Silverlight application).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The Silverlight runtime is still only 4.6MB in size.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The default control styles/templates have been modified.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Once Silverlight 2 is released, users with existing beta releases installed will automatically be upgraded to use the final version (also developer machines with RCO , I suppose).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;A modal dialog MessageBox is now available.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;System.Windows.Controls.Extended.dll renamed to System.Windows.Controls.dll&lt;/li&gt;&lt;br /&gt;&lt;li&gt;If you are using custom controls, remember that generic.xaml is now expected in the &#39;themes&#39; folder rather than at the root of the project.&lt;/li&gt;&lt;/ul&gt;</description><link>http://jimmangaly.blogspot.com/2008/09/silverlight-2-rco-is-out.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-6231771893657230529</guid><pubDate>Sat, 30 Aug 2008 18:39:00 +0000</pubDate><atom:updated>2008-09-01T05:04:21.268-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Silverlight on the Desktop</title><description>Its been almost two months since I blogged - just haven&#39;t had the time. But tonight I just couldn&#39;t resist making this post. My brilliant colleague at &lt;a href=&quot;http://www.identitymine.com/&quot;&gt;IdentityMine&lt;/a&gt;, &lt;a href=&quot;http://ctlabs.blogspot.com/2008/09/desklighter-carry-light-along.html&quot;&gt;Sameer Thiruthikad&lt;/a&gt; has been spearheading work on an exciting Silverlight utility called Desklighter, and the Beta is now public.&lt;br /&gt;&lt;br /&gt;What is the Desklighter? Well, ever wished you could package your Silverlight application into an stand alone executable that could work offline? That is precisely what the Desklighter enables you to do. Read the whole story &lt;a href=&quot;http://www.blendables.com/labs/Desklighter/Default.aspx&quot;&gt;here&lt;/a&gt;, and be sure to try it!</description><link>http://jimmangaly.blogspot.com/2008/08/silverlight-on-desktop.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-6610926080994775699</guid><pubDate>Thu, 05 Jun 2008 05:37:00 +0000</pubDate><atom:updated>2008-06-15T21:05:43.837-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>What&#39;s New In Silverlight 2 Beta 2?</title><description>Silverlight 2 Beta 2 was announced in TechEd earlier this week. &lt;s&gt;The actual bits are not yet public, but I think it should be soon.&lt;/s&gt;&lt;br /&gt;(&lt;u&gt;Update&lt;/u&gt;: The Beta 2 bits are &lt;a href=&quot;http://silverlight.net/GetStarted/&quot;&gt;now available&lt;/a&gt;. Scott Gu has a detailed list of changes &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2008/06/06/silverlight-2-beta2-released.aspx&quot;&gt;here&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;The best news for me was that there are several changes for making the Silverlight model as close as possible to the WPF model. This is very important for Silverlight to live up to its reputation of being a WPF subset (remember its code name &lt;em&gt;WPF Everywhere&lt;/em&gt;? )&lt;br /&gt;&lt;br /&gt;Below are some changes:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Improved Templating model using the Visual State Manager&lt;/li&gt;&lt;li&gt;New Tab Control&lt;/li&gt;&lt;li&gt;DataGrid improvements: Autosize, Reorder, Sort, Performance increase&lt;/li&gt;&lt;li&gt;TextBox: Text wrapping and multiline selection highlighting in textbox.&lt;/li&gt;&lt;li&gt;Includes the Visual Tree Helper.&lt;/li&gt;&lt;li&gt;DataBinding: Binding to attached properties is now supported.&lt;/li&gt;&lt;li&gt;Controls like the DataGrid which are now not part of the runtime (and have to be downloaded as part of the XAP) have been moved to the runtime. This is good news, but then the XAP is going to be heavier :).&lt;/li&gt;&lt;li&gt;DeepZoom: XML based file format&lt;/li&gt;&lt;li&gt;Full Screen Mode keyboard support: The only key supported earlier was escape. This was supposed to be for security reasons. Now additional keys are supported (arrow, tab, enter, home, end, pageup/pagedown, space).&lt;/li&gt;&lt;li&gt;A bunch of new stuff on the Networking side: Upload support for WebClient, ability to allow user to increase Isolated Storage capacity (via UI), duplex communications (&quot;push&quot; from Server to client), new VS template for “Silverlight-enabled WCF Service”.&lt;/li&gt;&lt;/ol&gt;To see a full list of changes see &lt;a href=&quot;http://blogs.msdn.com/silverlight_sdk/archive/2008/06/04/what-s-new-in-silverlight-2-beta-2.aspx&quot;&gt;this post&lt;/a&gt;.</description><link>http://jimmangaly.blogspot.com/2008/06/whats-new-in-silverlight-2-beta-2.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-8349912686269559161</guid><pubDate>Tue, 03 Jun 2008 10:39:00 +0000</pubDate><atom:updated>2008-06-04T05:26:52.648-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Training</category><title>Microsoft  Innovation Days, Kochi</title><description>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXfwjIcIuP-lF5SoAI8FWDCZtwY23gOiYvlyd6WkVXq8p_2wwslE8JkojA_O3hS-a2jFRW8yjxP2CJETyRpWtPHLJJmNDzE_PGSU_r8FJzl2juZT8qAuBsxY-_1NFRHAEZEccqSEAr8uEU/s1600-h/IMG_1069.JPG&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5207603854207476082&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXfwjIcIuP-lF5SoAI8FWDCZtwY23gOiYvlyd6WkVXq8p_2wwslE8JkojA_O3hS-a2jFRW8yjxP2CJETyRpWtPHLJJmNDzE_PGSU_r8FJzl2juZT8qAuBsxY-_1NFRHAEZEccqSEAr8uEU/s400/IMG_1069.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Microsoft India has been holding events around the country to get people excited about some of the newer technologies. Last week, an event was held at Kochi (Cochin) called Microsoft Innovation Days. One of the sessions was on Silverlight. Since &lt;a href=&quot;http://www.identitymine.com/&quot;&gt;IdentityMine &lt;/a&gt;has been into this technology for more than a year, we were invited to present a 30 minute part. I did the presentation on behalf of IdentityMine, and it was a great experience talking to the 200 odd developer crowd!&lt;/p&gt;&lt;p&gt;During the presentation, I showed a demo of a Silverlight 2 application we created. This was an application (not a full fledged one) that was created in just about a week&#39;s time. The short time period surprised a lot of people! &lt;/p&gt;&lt;p&gt;I discussed briefly some of the features used in the Silverlight demo - like Databinding, Templates, Animations, Drag and Drop, Video Brush, Isolated Storage, and Video Markers. I also shared some of our experiences working with Silverlight, including the Developer-Designer workflow. My session ended with a fun example of using templates - I had ported the &#39;Button Fish&#39; (of Avalon Feature Fest fame) to Silverlight&lt;/p&gt;&lt;p&gt;I think we had a lot of people excited about Silverlight. Many in the audience later expressed their desire to try out Silverlight. &lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2008/06/microsoft-innovation-days-kochi.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXfwjIcIuP-lF5SoAI8FWDCZtwY23gOiYvlyd6WkVXq8p_2wwslE8JkojA_O3hS-a2jFRW8yjxP2CJETyRpWtPHLJJmNDzE_PGSU_r8FJzl2juZT8qAuBsxY-_1NFRHAEZEccqSEAr8uEU/s72-c/IMG_1069.JPG" height="72" width="72"/><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-3754800556527360824</guid><pubDate>Sun, 11 May 2008 17:54:00 +0000</pubDate><atom:updated>2008-05-11T21:58:18.451-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Assemblies</category><category domain="http://www.blogger.com/atom/ns#">Namespaces</category><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Assemblies in the Silverlight Runtime</title><description>&lt;em&gt;&lt;u&gt;Note&lt;/u&gt;: &lt;/em&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;em&gt;Details in this post apply to Silverlight 2 Beta 1, and may change in future Silverlight versions.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;You may want to read &lt;/em&gt;&lt;a href=&quot;http://jimmangaly.blogspot.com/2008/05/namespaces-and-assembly-names.html&quot;&gt;&lt;em&gt;my previous post &lt;/em&gt;&lt;/a&gt;&lt;em&gt;to get a better understanding this post.&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Say you have a Silverlight application with a Canvas and a ListBox. Both these controls belong to the &lt;a href=&quot;http://jimmangaly.blogspot.com/2008/05/namespaces-and-assembly-names.html&quot;&gt;same namespace &lt;/a&gt;System.Windows.Controls. Will these controls be downloaded as part of this particular application&#39;s xap, or will this be part of the Silverlight runtime installed initially by the user?&lt;br /&gt;&lt;br /&gt;The answer is interesting: As far as Silverlight 2 Beta 1 is concerned, the Canvas is within the System.Windows.dll which is part of the Silverlight runtime and hence will &lt;em&gt;not&lt;/em&gt; be downloaded to the client along with the xap. However, the ListBox is within the System.Windows.Controls.dll which is not included in the Silverlight runtime. So this will be downloaded with the xap package.&lt;br /&gt;&lt;br /&gt;This also means that if you are creating a custom splash screen then you can use the Canvas within it, but not the ListBox since the splash screen will show before the xap has been downloaded.</description><link>http://jimmangaly.blogspot.com/2008/05/assemblies-in-silverlight-runtime.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-3544785211064993417</guid><pubDate>Fri, 09 May 2008 19:31:00 +0000</pubDate><atom:updated>2008-05-09T22:37:52.832-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Assemblies</category><category domain="http://www.blogger.com/atom/ns#">Namespaces</category><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Namespaces and Assembly Names</title><description>&lt;em&gt;&lt;u&gt;Note&lt;/u&gt;: Details in this post apply to Silverlight 2 Beta 1, and may change in future Silverlight versions. The basic idea though remains the same.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;A Silverlight developer recently reported this problem. He wanted to use the Silverlight DataGrid in his application. He knew that the DataGrid is a part of the assembly System.Windows.Controls.Data.dll. So he added a reference to this assembly in his Silverlight project. So far so good.&lt;br /&gt;&lt;br /&gt;Next he tried to import the namespace by typing in &quot;using System.Windows.Controls.Data&quot; so that he could start using the DataGrid. Now here started the problem. Visual Studio refused to recognize this namespace. Was this a bug in Silverlight, or perhaps in Visual Studio?&lt;br /&gt;&lt;br /&gt;Neither. It is true that the DataGrid resides in the assembly System.Windows.Controls.Data.dll; but it is still part of the SystemWindows.Controls namespace just like the other controls in Silverlight.&lt;br /&gt;&lt;br /&gt;Let us look at some other examples. The TextBlock, Canvas and Grid too belong to the System.Windows.Controls namespace but they actually reside in the assembly SystemWindows.dll not in SystemWindows.Controls.dll.&lt;br /&gt;&lt;br /&gt;By the way, the ListBox is one control that belongs to the namespace System.Windows.Controls and resides in an assembly with the same name.&lt;br /&gt;&lt;br /&gt;Simple, but interesting , huh?</description><link>http://jimmangaly.blogspot.com/2008/05/namespaces-and-assembly-names.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-8042100158827205322</guid><pubDate>Wed, 30 Apr 2008 12:05:00 +0000</pubDate><atom:updated>2008-05-01T13:49:06.742-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Silverlight Streaming</category><title>Testing Silverlight Streaming</title><description>&lt;iframe style=&quot;WIDTH: 400px; HEIGHT: 400px&quot; src=&quot;http://silverlight.services.live.com/invoke/66004/Testing%20Silverlight%20Streaming/iframe.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;If you are reading this blog, you certainly know about the&lt;a href=&quot;http://silverlight.live.com/&quot;&gt; Silverlight streaming service&lt;/a&gt;. But did you know that you can stream not just media but an entire Silverlight application? That&#39;s right, you can upload your Silverlight application to the Silverlight streaming server, and they take care of the rest. The video and button you see on this page are from a simple test app I uploaded to the server. All you need to do is just paste the html code they provide you after you upload your application.&lt;br /&gt;&lt;br /&gt;Want to try this out? &lt;a href=&quot;http://blogs.msdn.com/tims/archive/2008/03/18/uploading-silverlight-2-content-to-silverlight-streaming.aspx&quot;&gt;This post &lt;/a&gt;by Tim Sneath is a great place to start!</description><link>http://jimmangaly.blogspot.com/2008/04/testing-silverlight-streaming.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-5686242410577522030</guid><pubDate>Fri, 25 Apr 2008 11:48:00 +0000</pubDate><atom:updated>2008-06-16T02:36:39.716-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">On-Demand</category><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Using the WebClient to Download Content On-Demand</title><description>&lt;img id=&quot;BLOGGER_PHOTO_ID_5193153760065951106&quot; style=&quot;FLOAT: left; MARGIN: 0pt 10px 10px 0pt; WIDTH: 396px; CURSOR: pointer; HEIGHT: 400px&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzF8_KII5k6QR6xGNfLwHL94-vBQdyZK5i7uxOJ2EYLe0gzboHWoSeoGry65bclC_Rf2Lyyd8swtVn0QnpEWYpZzuUqvla9Kioihw_V2sASXEU_GO_exHcVf1hcGop7E_M-qQym0Rr21f/s400/OnDemand.jpg&quot; border=&quot;0&quot; /&gt;Source (Beta 2): The Beta 2 source is available &lt;a href=&quot;http://qzcufa.bay.livefilestore.com/y1pVB2NiFXYiCYFqEMtDDQ_wypWQhCl6LPmXsJ_lTOt0RH_2ChDO0Mu9jJBFlXN6v2uO2SCcKcKa1t7MAjQzQJ61g/Downloader-WebClient_Beta2.zip?download&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this post I&#39;m going to describe how you can use the WebClient class in Silverlight 2 to download content on-demand.&lt;br /&gt;&lt;br /&gt;Firstly why would you want to download something on-demand? Say your application is displaying images, video, lots of XAML etc. Now if you allow the appplication to download all of this initially to the client, the user may get impatient because of the long waiting period. You may lose your user even before he has had a first look at your application.&lt;br /&gt;&lt;br /&gt;So it makes sense to only include in the initial download, what is absolutely essential for the application to load. Once the application is loaded, you can start downloading other parts of the application behind the scenes. This is where downloading content on-demand comes into picture.&lt;br /&gt;&lt;br /&gt;We&#39;ll look at three scenarios.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Downloading a loose image file on-demand.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Downloading a zip file on demand and retrieving an image file.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Downloading an assembly on demand, and thereafter using classes within the assembly&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;The source for the sample application I created to illustrate this is available &lt;a href=&quot;http://qzcufa.bay.livefilestore.com/y1pVB2NiFXYiCYFqEMtDDQ_wypWQhCl6LPmXsJ_lTOt0RH_2ChDO0Mu9jJBFlXN6v2uO2SCcKcKa1t7MAjQzQJ61g/Downloader-WebClient_Beta2.zip?download&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Downloading a loose image file on-demand&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In Silverlight 1.0, the class used for downloading content on-demand was the Downloader class. In Silverlight 2, we use the WebClient class.&lt;br /&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; Button_Click_1(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt; wc = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadCompleted += &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventHandler&lt;/span&gt;(wc_OpenReadCompleted1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadAsync(&lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Uri&lt;/span&gt;(&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;&quot;bird.jpg&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;UriKind&lt;/span&gt;.Relative));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; wc_OpenReadCompleted1(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (e.Error == &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;StreamResourceInfo&lt;/span&gt; sri = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;StreamResourceInfo&lt;/span&gt;(e.Result &lt;span style=&quot;color:blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Stream&lt;/span&gt;, &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;BitmapImage&lt;/span&gt; imgsrc = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;BitmapImage&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;imgsrc.SetSource(sri.Stream);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;ImgToFill.Source = imgsrc;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;This code is quite self-explanatory. You need to call the OpenReadAsync method ofthe WebClient, and then retrieve the image in the OpenReadCompleted event.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Downloading a package (zip file) on-demand&lt;/strong&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt; and extracting an image file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this case the code is similar.&lt;br /&gt;&lt;br /&gt;To download a package&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Copy zip next to xap file&lt;/li&gt;&lt;li&gt;Download as stream using WebClient&lt;/li&gt;&lt;li&gt;Use StreamResourceInfo class to retrieve the desired part from the package stream&lt;/li&gt;&lt;/ol&gt;&lt;!--[if !vml]--&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; Button_Click_2(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt; wc = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadCompleted += &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventHandler&lt;/span&gt;(wc_OpenReadCompleted2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadAsync(&lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Uri&lt;/span&gt;(&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;&quot;mediaassets.zip&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;UriKind&lt;/span&gt;.Relative), &lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;&quot;Garden.jpg&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; wc_OpenReadCompleted2(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (e.Error == &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;StreamResourceInfo&lt;/span&gt; sri = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;StreamResourceInfo&lt;/span&gt;(e.Result &lt;span style=&quot;color:blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Stream&lt;/span&gt;, &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;String&lt;/span&gt; sURI = e.UserState &lt;span style=&quot;color:blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;String&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;StreamResourceInfo&lt;/span&gt; sri2 = &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Application&lt;/span&gt;.GetResourceStream(sri, &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Uri&lt;/span&gt;(sURI, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;UriKind&lt;/span&gt;.Relative));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;BitmapImage&lt;/span&gt; imgsrc = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;BitmapImage&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;imgsrc.SetSource(sri2.Stream);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;ImgToFill.Source = imgsrc;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;Notice that after downloading the zip package, we did not have to unzip it explicitly. The &lt;span style=&quot;FONT-STYLE: italic&quot;&gt;StreamResourceInfo &lt;/span&gt;class took care of that.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Downloading an assembly on-demand&lt;/strong&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt; and extracting an image file&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;What do we mean by downloading an assembly on-demand? Say you a large assembly that contains content like user controls, XAML etc. that you want to use in the application, but not in the first page that the application loads.&lt;br /&gt;&lt;br /&gt;In this case you you can download the assembly on-demand instead of loading it at the beginning when the application is loaded by the client.&lt;br /&gt;&lt;br /&gt;One question I had when I read of this concept was, wouldn&#39;t you have to reference the assembly in the application at design time itself to compile code that makes of its classes? And if you reference the assembly, won&#39;t it become part of the application&#39;s initial download to the client?&lt;br /&gt;&lt;br /&gt;Yes, it is true that you need to reference the assembly, but you set the &lt;span style=&quot;FONT-STYLE: italic&quot;&gt;private &lt;/span&gt;attribute of the csproj file for that assembly to false. In this case, the assembly will not become part of the xap package, but you can still call classes of this assembly in the code base.&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;font-size:10;&quot;  &gt;ProjectReference&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:red;&quot;&gt;Include&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;..\LargeSizeAssembly\LargeSizeAssembly.csproj&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;font-size:10;&quot;  &gt;Project&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;{51238BB3-5EC5-4B01-BABD-779DBF69F623}&lt;span style=&quot;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;Project&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;font-size:10;&quot;  &gt;Name&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;LargeSizeAssembly&lt;span style=&quot;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-family:Consolas;font-size:10;&quot;  &gt;Private&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;False&lt;span style=&quot;color:blue;&quot;&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;Private&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;!--&lt;/span--&gt;&lt;span style=&quot;COLOR: rgb(163,21,21);font-size:10;&quot; &gt;ProjectReference&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:10;color:blue;&quot;   &gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;Summarizing the steps, this is what you need to do:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add reference to the assembly&lt;/li&gt;&lt;li&gt;In the csproj file:&lt;projectreference include=&quot;SilverlightLibrary\SilverlightLibrary.proj&quot;&gt;&lt;private&gt;set the &#39;Private&#39; tag for that assembly to False&lt;/private&gt;&lt;/projectreference&gt;&lt;/li&gt;&lt;li&gt;Copy assembly next to xap file&lt;/li&gt;&lt;li&gt;Download as stream using WebClient&lt;/li&gt;&lt;li&gt;Use AssemblyPart class to load assembly to current AppDomain &lt;/li&gt;&lt;li&gt;Now start using classes in the assembly&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; Button_Click_3(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;RoutedEventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;// Download assembly &quot;on-demand&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt; wc = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;WebClient&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadCompleted += &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventHandler&lt;/span&gt;(wc_OpenReadCompleted3);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;wc.OpenReadAsync(&lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Uri&lt;/span&gt;(&lt;span style=&quot;COLOR: rgb(163,21,21)&quot;&gt;&quot;LargeSizeAssembly.dll&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;UriKind&lt;/span&gt;.Relative));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; wc_OpenReadCompleted3(&lt;span style=&quot;color:blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;OpenReadCompletedEventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;if&lt;/span&gt; (e.Error == &lt;span style=&quot;color:blue;&quot;&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;//Uncommenting the line below will throw an exception because the assembly &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;//in which Page2 resides has not been loaded into current AppDomain as yet&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;//Page2 page2 = new Page2();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;color:green;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:green;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;color:green;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;// Convert the downloaded stream into an assembly that is&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;// loaded into current AppDomain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;AssemblyPart&lt;/span&gt; assemblyPart = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;AssemblyPart&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;assemblyPart.Load(e.Result);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;//now access classes in the downloaded assembly&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;DisplayPageFromLibraryAssembly();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt; DisplayPageFromLibraryAssembly()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;// Instantiate type from assembly&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Page2&lt;/span&gt; page2 = &lt;span style=&quot;color:blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: rgb(43,145,175)&quot;&gt;Page2&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:green;&quot;&gt;// display it&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal&quot;&gt;&lt;span style=&quot;font-family:Consolas;font-size:10;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;LayoutRoot.Children.Add(page2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:10;&quot;  &gt;&lt;span style=&quot;font-size:0;&quot;&gt;&lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;You can see how powerful this option of downloading on-demand is. The source for the sample application I created to illustrate this is available &lt;a href=&quot;http://qzcufa.bay.livefilestore.com/y1pVB2NiFXYiCYFqEMtDDQ_wypWQhCl6LPmXsJ_lTOt0RH_2ChDO0Mu9jJBFlXN6v2uO2SCcKcKa1t7MAjQzQJ61g/Downloader-WebClient_Beta2.zip?download&quot;&gt;here&lt;/a&gt;.</description><link>http://jimmangaly.blogspot.com/2008/04/using-webclient-to-download-content-on.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzF8_KII5k6QR6xGNfLwHL94-vBQdyZK5i7uxOJ2EYLe0gzboHWoSeoGry65bclC_Rf2Lyyd8swtVn0QnpEWYpZzuUqvla9Kioihw_V2sASXEU_GO_exHcVf1hcGop7E_M-qQym0Rr21f/s72-c/OnDemand.jpg" height="72" width="72"/><thr:total>18</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-7550663770026026295</guid><pubDate>Wed, 23 Apr 2008 04:02:00 +0000</pubDate><atom:updated>2008-04-22T21:13:20.064-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>XAMLPad for Silverlight</title><description>XAMLPad is a tool for WPF that ships with the Windows SDK, and allows you to easily parse and render XAML snippets. As far as I know XAMLPad for Silverlight is not available as yet. However, Robby Ingebretsen who also works for &lt;a href=&quot;http://www.identitymine.com/&quot;&gt;IdentityMine &lt;/a&gt;has added Silverlight support to his &lt;a href=&quot;http://www.kaxaml.com/&quot;&gt;Kaxaml &lt;/a&gt;tool. After you launch Kaxaml, you can open a new tab either in WPF, or in Silverlight.&lt;br /&gt;&lt;br /&gt;By the way, this tool has been created in WPF. Really cool!</description><link>http://jimmangaly.blogspot.com/2008/04/xamlpad-for-silverlight.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-6060159662704334718</guid><pubDate>Tue, 22 Apr 2008 13:05:00 +0000</pubDate><atom:updated>2008-04-22T06:10:05.122-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Detecting Screen Width and Height from within a Silverlight app</title><description>There are no direct API&#39;s that allow you to detect the screen width and height from within a Silverlight plug-in. But &lt;a href=&quot;http://nerddawg.blogspot.com/2008/04/how-to-tell-screen-resolution-from.html&quot;&gt;this post &lt;/a&gt;by Ashish Shetty tells you how to do this.</description><link>http://jimmangaly.blogspot.com/2008/04/detecting-screen-width-and-height-from.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-8774690229206598799</guid><pubDate>Fri, 18 Apr 2008 20:19:00 +0000</pubDate><atom:updated>2008-04-18T14:32:12.752-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Data Binding</category><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Templates</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>Differences between the WPF and Silverlight 2 model</title><description>What are the differences between the WPF and Silverlight 2 model? If you have worked with WPF &lt;em&gt;before&lt;/em&gt; you started working with Silverlight (like me!), then this is no doubt a key question lingering in your mind. I understand that Microsoft is planning to publish such a list, and that would be great when it comes. But until that is published, below is a list of differences that I have picked so far. Remember this is a comparision between WPF and Silverlight 2 Beta 1. Some of the gaps between these two related technologies may be filled  in future releases of Silverlight.&lt;br /&gt;&lt;br /&gt;The observations below are what apply to Silverlight 2 Beta 1.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Styles&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Once you apply a style to a FrameworkElement, you &lt;u&gt;cannot reassign a new style&lt;/u&gt;. This is bad news because this means that the user cannot pick a theme. Having said that, you can still reassign properties that have been once assigned. This means that you can reassign the control template since it is a property as well.&lt;/li&gt;&lt;li&gt;Styles &lt;u&gt;cannot inherit&lt;/u&gt; from other styles - the &#39;BasedOn&#39; property cannot be used.&lt;/li&gt;&lt;li&gt;Styles &lt;u&gt;&lt;em&gt;have &lt;/em&gt;to be referenced by a key&lt;/u&gt;. This means that you cannot drop a style for a button in your &#39;application.resources&#39; hoping that all buttons in the application will pick up the style. You need to explicitly reference it by its key in all buttons in the application. Sigh!&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Triggers&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;See my &lt;a href=&quot;http://jimmangaly.blogspot.com/2008/03/no-triggers-in-silverlight-2-beta.html&quot;&gt;earlier post &lt;/a&gt;on this. There are &lt;u&gt;no triggers&lt;/u&gt; in Silverlight Beta 1 for styles, control templates and data templates. Sigh, sigh and more sigh! &lt;/p&gt;&lt;p&gt;Say you are changing the control template of a button. When doing that, as part of the template you would want to define an animation that should fire when the mouse is over it. In WPF, you would just add a trigger in the control template that looks for the IsMouseOver property - which is a neat way of doing things. But in Silverlight, the developer who creates the control has to create event handlers for the MouseEnter and MouseLeave events, and in these event handlers he has to load storyboards with well known names. Then hope that the designer/developer skinning the control will supply storyboards with the same names!&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Control Templates&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;Keeping aside the limitation control templates have that I explained above (in the triggers section), I think this is one area that Silverlight is better than WPF. Silverlight follows the &lt;u&gt;parts model&lt;/u&gt;. This means that any control (controls that ship with Silverlight and custom controls) publish a well defined &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/cc189093(vs.95).aspx&quot;&gt;control contract&lt;/a&gt;. This control contract will define &lt;/p&gt;&lt;ol&gt;&lt;li&gt;the minimum UIElements (and their names) that should be present in a control template for that control &lt;/li&gt;&lt;li&gt;the storyboards (and their names) that should be present. &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;So this means  that a designer/developer who is going to skin (or define a new control template for) the control needs to only look at the control contract to understand what the control expects to function properly.&lt;/p&gt;&lt;p&gt;In WPF, you have to search for the &quot;PART_&quot; prefix in the default control template. There is no well-defined control contract. I understand from the MIX talks that this is one area that WPF, the big brother, will listen to Silverlight and emulate it in future WPF releases.&lt;/p&gt;&lt;p&gt;Also, a custom control in Silverlight cannot inherit from UIElement or FrameworkElement classes though these classes are present (by the way, there is no Visual class in the class hierarchy in Silverlight). &lt;u&gt;Custom controls should extend the Control class&lt;/u&gt;, or other classes like TextBox or Button that extend the Control class.&lt;/p&gt;&lt;p&gt;What makes skinning a control (read changing its control template) really complicated now is that at the moment Blend does not support templating. I&#39;m sure that is coming. But until then, your XAML editing skills will be put to the test!&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;u&gt;Dynamic resource&lt;/u&gt; references are not available. All are static references.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Data Binding&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The following apply to Silverlight 2 Beta 1:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;No binding the property of a UI control to the property of another UI control. There is no &lt;u&gt;&#39;ElementName&#39;&lt;/u&gt; property in the binding syntax.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;&#39;RelativeSource&#39;&lt;/u&gt; &lt;/li&gt;&lt;li&gt;No &lt;u&gt;&#39;OneWayToSource&#39;&lt;/u&gt; - who needed it anyway?&lt;/li&gt;&lt;li&gt;No &lt;u&gt;UpdateSourceTrigger&lt;/u&gt; property. All updates to the source (for two way binding) happen immediately, except in the case of TextBox in which case changes are propogated to the source when the focus is lost.&lt;/li&gt;&lt;li&gt;Cannot bind directly to &lt;u&gt;XML data&lt;/u&gt;. Need to convert the XML to CLR objects, and then bind to the CLR object.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;ReadOnlyObservableCollection&lt;/u&gt;. Fortunately, the ObservableCollection is available which is more important.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;CollectionView&lt;/u&gt; for sorting and filtering.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;validation rules&lt;/u&gt;.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;DataTemplateSelector&lt;/u&gt; for dynamically selecting data templates based on data.&lt;/li&gt;&lt;li&gt;No &lt;u&gt;XMLDataProvider&lt;/u&gt; and &lt;u&gt;ObjectDataProvider&lt;/u&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Commanding&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Commands and input bindings are not available in Silverlight 2 Beta 1.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;These are a few things I observed about Silverlight 2. I plan to keep this list updated so that this will be a ready reference for someone looking for the differences between the WPF and Silverlight 2 model. &lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2008/04/differences-between-wpf-and-silverlight.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>7</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-2133763783360504682</guid><pubDate>Fri, 11 Apr 2008 12:12:00 +0000</pubDate><atom:updated>2008-04-11T05:28:41.426-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Tip</category><title>Debugging not working for your Silverlight project?</title><description>If you are bugged by the fact that debugging does not work for your Silverlight project, make sure that &#39;Silverlight&#39; has been checked as one of the debuggers in the &#39;Start Options&#39; of your project properties.&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5187963471914351378&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigBkc__G4sXlgbzujhJCHYXvES3hI_jN-aFHcb5veFn0GRZUAcJeOe05tHXWtsWBtx2TeD6IM7tn2pmKcTOLmBVsQex02_UFTupQrH0L3re9_hM2kuFZjHfmGr3oL-PP717GieCQROjnwq/s400/DebugSilverlight.jpg&quot; border=&quot;0&quot; /&gt; &lt;div&gt;&lt;/div&gt;&lt;div&gt;Happy debugging!&lt;/div&gt;&lt;/div&gt;</description><link>http://jimmangaly.blogspot.com/2008/04/debugging-not-working-for-your.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigBkc__G4sXlgbzujhJCHYXvES3hI_jN-aFHcb5veFn0GRZUAcJeOe05tHXWtsWBtx2TeD6IM7tn2pmKcTOLmBVsQex02_UFTupQrH0L3re9_hM2kuFZjHfmGr3oL-PP717GieCQROjnwq/s72-c/DebugSilverlight.jpg" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-6035785717628817638</guid><pubDate>Thu, 10 Apr 2008 09:22:00 +0000</pubDate><atom:updated>2008-06-16T05:42:37.238-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Resource Files</category><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><title>Understanding Application Resource Files</title><description>First let me mention that the word &quot;resources&quot; is used in two contexts in Silverlight (and WPF). The main usage refers to styles, templates etc. that are reusable resources. The other usage is for referring to application resource files like images, videos etc that are used by the application. This post is about the latter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNcT3-p2OLDQYSqHQvCnI23w61b0aGqiGAIAs1bKZ1HiO2COExZCtjRrWVVbgIJzl8PX4x0-dGOOAhUbl8BsAviK2uyYhWPZK8pSwsNoIlaAKyBjvg0UMFUIG4a3leRFi62XKzM3qkrscJ/s1600-h/SolutionExplorer.JPG&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5187546546554026658&quot; style=&quot;FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand&quot; height=&quot;179&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNcT3-p2OLDQYSqHQvCnI23w61b0aGqiGAIAs1bKZ1HiO2COExZCtjRrWVVbgIJzl8PX4x0-dGOOAhUbl8BsAviK2uyYhWPZK8pSwsNoIlaAKyBjvg0UMFUIG4a3leRFi62XKzM3qkrscJ/s200/SolutionExplorer.JPG&quot; width=&quot;155&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;When you add such resources to a Silverlight application you can set their build action mainly in three ways: &lt;em&gt;Resource, Content&lt;/em&gt; or &lt;em&gt;None&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;In the example on the left, I have added 3 images - one as &lt;em&gt;Resource&lt;/em&gt;, the second as &lt;em&gt;Content &lt;/em&gt;and the last as &lt;em&gt;None&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;What happens to these images when the application is compiled? The image assigned as &lt;em&gt;Resource&lt;/em&gt; (Bread.png) gets embedded into the Silverlight application assembly. So this image is not seen in the screenshots below. The image assigned as &lt;em&gt;Content&lt;/em&gt; (Burger.png) is not embedded into the application assembly but nevertheless gets packaged into the .xap file. (Remember that the .xap file is basically a zip file renamed with .xap extension . This zip file contains the application assembly as well as other &lt;em&gt;Content&lt;/em&gt; resource files.) The image assigned as &lt;em&gt;None&lt;/em&gt; (Watermelon.png) is a loose resource file and so is outside the .xap package.&lt;br /&gt;The screenshots below should be helpful to visualize this.&lt;br /&gt;&lt;br /&gt;Ths screenshot is of the client bin. You can see the .xap package and the image marked as &lt;em&gt;None&lt;/em&gt;. This resource can act as an on-Demand resource file, and so will not be downloaded initially to the client machine. It will be downloaded only when the user navigates to the page that displays this image.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5E8h2AhhU_7VPknNG-PEVlOIMGcGkdqY-ZQRVx9vFqn-8fS_GWQKs1Tcnqy5f1ML-5QP4-0wLfuX7mcL3s12OimhNDj5GoJY_hTZkMyizpamkgvqkytfCwWh-NTazuRYYONQCOAUuBaFL/s1600-h/ClientBin.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5187552147191380690&quot; style=&quot;CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5E8h2AhhU_7VPknNG-PEVlOIMGcGkdqY-ZQRVx9vFqn-8fS_GWQKs1Tcnqy5f1ML-5QP4-0wLfuX7mcL3s12OimhNDj5GoJY_hTZkMyizpamkgvqkytfCwWh-NTazuRYYONQCOAUuBaFL/s320/ClientBin.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy839prOtlIv0-ZztTc_b56slg6SgdREt2J1kIH6UP9SwdbW1VIhyphenhyphenjnza_EJh2CBszKFIi8Np_k6spnWzqwKhjxD8AFSovkStRfA3lR6YCodHudc1t32GNU_WBMVPcP244cfaN9dEaq5jY/s1600-h/XAP.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5187552147191380706&quot; style=&quot;FLOAT: left; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy839prOtlIv0-ZztTc_b56slg6SgdREt2J1kIH6UP9SwdbW1VIhyphenhyphenjnza_EJh2CBszKFIi8Np_k6spnWzqwKhjxD8AFSovkStRfA3lR6YCodHudc1t32GNU_WBMVPcP244cfaN9dEaq5jY/s320/XAP.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; When the .xap package is unzipped, you get the files shown in the screenshot on the left. You can see that the image marked as &lt;em&gt;Content&lt;/em&gt; is part of the unzipped contents. The image marked as &lt;em&gt;Resource&lt;/em&gt; is embedded with the application assembly (ResourceFiles.dll) and hence cannot be seen in this screen shot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How should one refer to these resources in the XAML? And when would one prefer to use one type of build action over the other? This &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/cc296240(vs.95).aspx&quot;&gt;MSDN article &lt;/a&gt;explains this thoroughly. Also, &lt;a href=&quot;http://nerddawg.blogspot.com/2008/03/silverlight-2-demystifying-uri.html&quot;&gt;this post &lt;/a&gt;by Ashish Shetty.&lt;br /&gt;&lt;br /&gt;You can find the sample application I described above &lt;a href=&quot;http://qzcufa.bay.livefilestore.com/y1pTFP5UL74kaNAoKY9AVak-bfOsfOJcDMlnCYrbuk-YLpnqQIrGsfiM8iGQiWaIzMAdwyGupqRDwSZqTFNg02mupXJZrvzFpXP/ResourceFiles-Beta2.zip?download&quot;&gt;here&lt;/a&gt; &lt;em&gt;(updated to Beta 2)&lt;/em&gt;.</description><link>http://jimmangaly.blogspot.com/2008/04/understanding-application-resource.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNcT3-p2OLDQYSqHQvCnI23w61b0aGqiGAIAs1bKZ1HiO2COExZCtjRrWVVbgIJzl8PX4x0-dGOOAhUbl8BsAviK2uyYhWPZK8pSwsNoIlaAKyBjvg0UMFUIG4a3leRFi62XKzM3qkrscJ/s72-c/SolutionExplorer.JPG" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-7120616713119596303</guid><pubDate>Wed, 09 Apr 2008 12:31:00 +0000</pubDate><atom:updated>2008-04-09T06:23:41.973-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tip</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>XAML Tip - How do I escape curly braces?</title><description>Ever wondered how you would get a TextBlock to display some text with the curly braces? For example, say you wanted to display the text &lt;em&gt;{Hello}&lt;/em&gt;. If you just say, &lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21); LINE-HEIGHT: 115%font-family:Consolas;font-size:85%;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt; &lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:red;&quot;   &gt;Text&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt;=&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;&quot;  &gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;{Hello}&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt; you will not get the desired result since the parser will assume that it is a markup extension.&lt;br /&gt;&lt;br /&gt;This is what you should do to trick the parser: &lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt;&lt;&lt;/span&gt;&lt;span style=&quot;COLOR: rgb(163,21,21); LINE-HEIGHT: 115%font-family:Consolas;font-size:85%;&quot;  &gt;TextBlock&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt; &lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:red;&quot;   &gt;Text&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;color:blue;&quot;   &gt;=&lt;/span&gt;&lt;span style=&quot;LINE-HEIGHT: 115%;font-family:Consolas;font-size:85%;&quot;  &gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;{}{Hello}&lt;/span&gt;&quot;&lt;span style=&quot;color:blue;&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Simple, eh?</description><link>http://jimmangaly.blogspot.com/2008/04/xamltip-how-do-i-escape-curly-braces.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-3748286166928031862</guid><pubDate>Mon, 31 Mar 2008 03:34:00 +0000</pubDate><atom:updated>2008-03-30T23:41:18.878-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Training</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>We told you so!</title><description>Last December, we at &lt;a href=&quot;http://www.identitymine.com/&quot;&gt;IdentityMine&lt;/a&gt; did a Silverlight 1.0 training at Mumbai and Bangalore in which we had a wonderful audience - a total of more than 50 from various companies around India participating. Though the training was primarily on Silverlight, we also covered some &#39;then-WPF-only concepts&#39; like Styles, Templates and Data Binding.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5183749359474059970&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhepITZA9u5ELwWVCPnVMeqAVWfqGFmt-xe8H3QRxgeGO8JK9XgBpJ4B9WTCA-eJzmrTVrNxtaKGtETfJ2lqWGcepynm5aeHyG1Mi1RqmOPO6I6UYOMnqWk61UR4YfLYicKfjXV7kklfNu8/s320/IMG_1149.JPG&quot; border=&quot;0&quot; /&gt; &lt;/p&gt;&lt;p&gt;While most of the feedback was very positive, I still remember a few questioning the rationale behind including these &quot;WPF concepts&quot; in a Silverlight training session. Of course, the reason was, as we mentioned during the course, that these concepts would be included in Silverlight 2 later. And included they are! I&#39;m sure they now realize that they have had a great sneak peek into these important concepts months ahead of the Silverlight 2 Beta release. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;We told you so!&lt;/p&gt;</description><link>http://jimmangaly.blogspot.com/2008/03/we-told-you-so.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhepITZA9u5ELwWVCPnVMeqAVWfqGFmt-xe8H3QRxgeGO8JK9XgBpJ4B9WTCA-eJzmrTVrNxtaKGtETfJ2lqWGcepynm5aeHyG1Mi1RqmOPO6I6UYOMnqWk61UR4YfLYicKfjXV7kklfNu8/s72-c/IMG_1149.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-8939524841916446707</guid><pubDate>Fri, 28 Mar 2008 11:43:00 +0000</pubDate><atom:updated>2008-03-28T05:04:29.624-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Silverlight Spy</category><category domain="http://www.blogger.com/atom/ns#">Snoop</category><title>Silverlight Spy - &#39;Snoop for Silverlight&#39;</title><description>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-HWYd5PTvL9vkj06XK1VGMQn_171GFXYwHDMA7z9GC4vgcueXSvxxX1WmqBWNoA2j4yhRpxrCxjkyRCNrNi7WYpLIXl8iVC3uDwDgoDhrqy3MuVLdCHDd3wPkTKcoc_l4DRqYL52grHya/s1600-h/SilverlightSpy.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5182758922835733138&quot; style=&quot;FLOAT: right; MARGIN: 0px 0px 10px 10px; WIDTH: 269px; CURSOR: hand; HEIGHT: 184px&quot; height=&quot;240&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-HWYd5PTvL9vkj06XK1VGMQn_171GFXYwHDMA7z9GC4vgcueXSvxxX1WmqBWNoA2j4yhRpxrCxjkyRCNrNi7WYpLIXl8iVC3uDwDgoDhrqy3MuVLdCHDd3wPkTKcoc_l4DRqYL52grHya/s320/SilverlightSpy.jpg&quot; width=&quot;321&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Those who have worked in depth with WPF know what a valuable tool &lt;a href=&quot;http://www.blois.us/Snoop/&quot;&gt;Snoop &lt;/a&gt;is. It allows you to see the visual tree of a WPF application, change values, track events and much more! Just the other day I was thinking how good it would be if we had a &#39;Snoop for Silverlight&#39;.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I recently discovered &lt;a href=&quot;http://www.silverlightspy.com/silverlightspy/&quot;&gt;Silverlight Spy&lt;/a&gt;, which does just that. You can snoop into the visual tree of any Silverlight 2 application. Before you install it, make sure you have installed the &lt;a href=&quot;http://www.silverlightspy.com/silverlightspy/Download.aspx&quot;&gt;pre-requisites&lt;/a&gt;, escpecially the web browser control that it needs to stream the web content.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Happy spying!&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;</description><link>http://jimmangaly.blogspot.com/2008/03/silverlight-spy-snoop-for-silverlight.html</link><author>noreply@blogger.com (Jim Mangaly)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-HWYd5PTvL9vkj06XK1VGMQn_171GFXYwHDMA7z9GC4vgcueXSvxxX1WmqBWNoA2j4yhRpxrCxjkyRCNrNi7WYpLIXl8iVC3uDwDgoDhrqy3MuVLdCHDd3wPkTKcoc_l4DRqYL52grHya/s72-c/SilverlightSpy.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-4033606624940511929</guid><pubDate>Fri, 28 Mar 2008 05:43:00 +0000</pubDate><atom:updated>2008-04-18T14:35:27.386-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Silverlight</category><category domain="http://www.blogger.com/atom/ns#">Templates</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>No Triggers in Silverlight 2 Beta!</title><description>Being a WPF developer, I have been hoping that the Silverlight model would resemble WPF closely. After all, Silverlight is supposed to be a &#39;subset&#39; of WPF (remember the code name for Silverlight was WPF/E - &#39;WPF Everywhere&#39;).&lt;br /&gt;&lt;br /&gt;Now that Silverlight 2 Beta is out, I have been looking at it very closely. As expected a lot of features are common to WPF - styles, templates, databinding etc. But what on earth happened to triggers? Triggers are missing! C&#39;mon Microsoft don&#39;t tell us there are no triggers in Silverlight. I&#39;m hoping that triggers will arrive before the final release of Silverlight.&lt;br /&gt;&lt;br /&gt;By the way, let me clarify that when I say that there are no triggers in Silverlight 2 Beta 1 what I mean is no triggers where they matter most - in styles, control templates and data templates. The FrameworkElement class does have a trigger collection, but that is not very useful is it, without triggers in styles and templates?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Update&lt;/strong&gt;: For a full discussion on the differences between the WPF and Silverlight 2 model, see &lt;a href=&quot;http://jimmangaly.blogspot.com/2008/04/differences-between-wpf-and-silverlight.html&quot;&gt;this post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Also enjoy this geeky duel on the new Silverlight templating model (sans triggers) between two of my esteemed colleagues at IdentityMine - &lt;a href=&quot;http://notstatic.com/archives/141&quot;&gt;Robby Ingebretsen &lt;/a&gt;and &lt;a href=&quot;http://drwpf.com/blog/Home/tabid/36/EntryID/31/Default.aspx&quot;&gt;Dr. WPF&lt;/a&gt;.</description><link>http://jimmangaly.blogspot.com/2008/03/no-triggers-in-silverlight-2-beta.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5641045166738036061.post-5533371111511297413</guid><pubDate>Thu, 27 Mar 2008 11:18:00 +0000</pubDate><atom:updated>2008-06-03T02:43:27.832-07:00</atom:updated><title>Joining the Bandwagon!</title><description>Finally... I decided to blog!&lt;br /&gt;&lt;br /&gt;I plan to blog on my experiences with WPF and Silverlight, technologies that I currently work on and ones that I have come to love. I work with &lt;a href=&quot;http://www.identitymine.com/&quot;&gt;IdentityMine&lt;/a&gt; at their Kochi office in India, and that means that I&#39;ve had plenty of opportunities to do a lot of interesting work with these technologies. I have been working with WPF for over two years and Silverlight for about a year. Recently, I was also privileged do some corporate training in WPF and Silverlight for other software firms in India, and that was an experience I really enjoyed.&lt;br /&gt;&lt;br /&gt;Hope you enjoy reading my blog!</description><link>http://jimmangaly.blogspot.com/2008/03/joining-bandwagon.html</link><author>noreply@blogger.com (Jim Mangaly)</author><thr:total>3</thr:total></item></channel></rss>