<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-6938791</id><updated>2009-11-11T16:24:34.476Z</updated><title type='text'>El color dels somnis</title><subtitle type='html'>Primarily thoughts on Microsoft UI Technologies and personal rants (caution: may include cat-related material)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default?start-index=26&amp;max-results=25'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6938791.post-4962737270475995986</id><published>2009-08-11T07:26:00.001+01:00</published><updated>2009-08-11T07:26:35.471+01:00</updated><title type='text'>Five Minute Silverlight 3 Aides-Memoire #5 – Based on Styles</title><content type='html'>&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ColouredContentControlStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ContentControl&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Height&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Width&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Margin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontFamily&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Verdana&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontSize&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;14&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Italic&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ColouredCheckBoxStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BasedOn&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ColouredContentControlStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBox&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Width&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RedButtonStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BasedOn&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ColouredContentControlStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GreenButtonStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BasedOn&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ColouredContentControlStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Green&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;YellowCheckBoxStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BasedOn&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ColouredCheckBoxStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBox&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OrangeRadioButtonStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BasedOn&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;ColouredContentControlStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadioButton&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Orange&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Width&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;190&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontWeight&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Vertical&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;RedButtonStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red Button&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;YellowCheckBoxStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow CheckBox&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RadioButton &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;OrangeRadioButtonStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Orange RadioButton&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;GreenButtonStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Green Button&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/SoEPFRqyF3I/AAAAAAAAAEY/oqAPdmtSGxE/s1600-h/FiveMinuteSilverlight3_53.png"&gt;&lt;img style="border-right-width: 0px; margin: 30px 0px 0px 30px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="FiveMinuteSilverlight3_5" border="0" alt="FiveMinuteSilverlight3_5" src="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SoEPGSB17LI/AAAAAAAAAEc/gXWp0K09PQ8/FiveMinuteSilverlight3_5_thumb1.png?imgmax=800" width="308" height="284" /&gt;&lt;/a&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4962737270475995986?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4962737270475995986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4962737270475995986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4962737270475995986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4962737270475995986'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/08/five-minute-silverlight-3-aides-memoire_4427.html' title='Five Minute Silverlight 3 Aides-Memoire #5 – Based on Styles'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-8941459195946211115</id><published>2009-08-11T07:25:00.001+01:00</published><updated>2009-08-11T07:25:26.976+01:00</updated><title type='text'>Five Minute Silverlight 3 Aides-Memoire #4 – Merged Resource Dictionaries</title><content type='html'>&lt;p&gt;&lt;strong&gt;ButtonStyles.xaml:&lt;/strong&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ButtonsStyles&amp;quot; &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;br /&gt;    &amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RedButton&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Height&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Width&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Margin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GreenButton&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Green&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Height&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Width&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Margin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;CheckBoxStyles.xaml:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBoxStyles&amp;quot;&lt;br /&gt;    &amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;YellowCheckBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBox&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Height&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Margin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OrangeCheckBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBox&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Orange&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Height&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Margin&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;MainPage.xaml:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ButtonStyles.xaml&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CheckBoxStyles.xaml&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;RedButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red Button&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;GreenButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Green Button&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;YellowCheckBox&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow CheckBox&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;OrangeCheckBox&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Orange CheckBox&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/SoEOqr1lMmI/AAAAAAAAAEQ/oXdCYXqRSLQ/s1600-h/FiveMinuteSilverlight3_43.png"&gt;&lt;img style="border-right-width: 0px; margin: 30px 0px 0px 30px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="FiveMinuteSilverlight3_4" border="0" alt="FiveMinuteSilverlight3_4" src="http://lh3.ggpht.com/_E_ZM9Y7o2Ow/SoEOrvc7tbI/AAAAAAAAAEU/zQGXix_qDxs/FiveMinuteSilverlight3_4_thumb1.png?imgmax=800" width="519" height="137" /&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-8941459195946211115?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/8941459195946211115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=8941459195946211115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8941459195946211115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8941459195946211115'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/08/five-minute-silverlight-3-aides-memoire_11.html' title='Five Minute Silverlight 3 Aides-Memoire #4 – Merged Resource Dictionaries'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-413714132242065117</id><published>2009-08-06T20:36:00.001+01:00</published><updated>2009-08-06T20:36:39.207+01:00</updated><title type='text'>Five Minute Silverlight 3 Aides-Memoire #3 – Element-to-element binding</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;40&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,50,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OpenfeatureLizardSquare.jpg&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ImagePlaneProjection&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Slider &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;RotationX&lt;/span&gt;&lt;span style="color: blue"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, &lt;/span&gt;&lt;span style="color: red"&gt;ElementName&lt;/span&gt;&lt;span style="color: blue"&gt;=ImagePlaneProjection}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;XSlider&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Minimum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-360&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Maximum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;360&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,10&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Slider &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;Mode&lt;/span&gt;&lt;span style="color: blue"&gt;=TwoWay, &lt;/span&gt;&lt;span style="color: red"&gt;ElementName&lt;/span&gt;&lt;span style="color: blue"&gt;=ImagePlaneProjection}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;YSlider&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Minimum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-360&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Maximum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;360&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,10&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://lh3.ggpht.com/_E_ZM9Y7o2Ow/SnswxOm3qUI/AAAAAAAAAEI/_evV-7LScTc/s1600-h/FiveMinuteSilverlight3_33.png"&gt;&lt;img style="border-right-width: 0px; margin: 30px 0px 0px 30px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="FiveMinuteSilverlight3_3" border="0" alt="FiveMinuteSilverlight3_3" src="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SnswxtBEg0I/AAAAAAAAAEM/JeR7xVBKAa4/FiveMinuteSilverlight3_3_thumb1.png?imgmax=800" width="426" height="291" /&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-413714132242065117?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/413714132242065117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=413714132242065117' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/413714132242065117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/413714132242065117'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/08/five-minute-silverlight-3-aides-memoire_06.html' title='Five Minute Silverlight 3 Aides-Memoire #3 – Element-to-element binding'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-4914674841908019052</id><published>2009-08-05T21:16:00.001+01:00</published><updated>2009-08-05T21:18:04.919+01:00</updated><title type='text'>Five Minute Silverlight 3 Aides-Memoire #2 – Pixel Effects</title><content type='html'>&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,50,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OpenfeatureLizardSquare.jpg&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Effect&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;BlurEffect &lt;/span&gt;&lt;span style="color: red"&gt;Radius&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Effect&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,50,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OpenfeatureLizardSquare.jpg&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Effect&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DropShadowEffect &lt;/span&gt;&lt;span style="color: red"&gt;ShadowDepth&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Effect&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SnnohVhfgYI/AAAAAAAAAEA/LPVgHC6hfOg/s1600-h/FiveMinuteSilverlight3_2%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; margin: 30px 0px 0px 30px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="FiveMinuteSilverlight3_2" border="0" alt="FiveMinuteSilverlight3_2" src="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SnnojGOar2I/AAAAAAAAAEE/yinmEqpgbW0/FiveMinuteSilverlight3_2_thumb%5B3%5D.png?imgmax=800" width="599" height="279" /&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4914674841908019052?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4914674841908019052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4914674841908019052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4914674841908019052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4914674841908019052'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/08/five-minute-silverlight-3-aides-memoire_05.html' title='Five Minute Silverlight 3 Aides-Memoire #2 – Pixel Effects'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-3463500769181650436</id><published>2009-08-05T21:04:00.001+01:00</published><updated>2009-08-05T21:04:18.398+01:00</updated><title type='text'>Five Minute Silverlight 3 Aides-Memoire #1 – 3D Projection</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush &lt;/span&gt;&lt;span style="color: red"&gt;EndPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StartPoint&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;GradientStop &lt;/span&gt;&lt;span style="color: red"&gt;Color&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinearGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50,50,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;OpenfeatureLizardSquare.jpg&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;RotationX&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-25&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;45&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://lh3.ggpht.com/_E_ZM9Y7o2Ow/SnnltqHHLOI/AAAAAAAAAD4/WWBMxJWOj8g/s1600-h/FiveMinuteSilverlight3_1%5B2%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 30px 0px 0px 30px; display: inline; border-top: 0px; border-right: 0px" title="FiveMinuteSilverlight3_1" border="0" alt="FiveMinuteSilverlight3_1" src="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SnnlwLZ0eLI/AAAAAAAAAD8/rhum0NN3ZVE/FiveMinuteSilverlight3_1_thumb.png?imgmax=800" width="244" height="244" /&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-3463500769181650436?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/3463500769181650436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=3463500769181650436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/3463500769181650436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/3463500769181650436'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/08/five-minute-silverlight-3-aides-memoire.html' title='Five Minute Silverlight 3 Aides-Memoire #1 – 3D Projection'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-1164631839856251459</id><published>2009-06-10T23:29:00.001+01:00</published><updated>2009-06-10T23:29:35.223+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='3D'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight 3 Beta'/><category scheme='http://www.blogger.com/atom/ns#' term='Petzold'/><category scheme='http://www.blogger.com/atom/ns#' term='Rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='Plane Projection'/><category scheme='http://www.blogger.com/atom/ns#' term='PhotoCube'/><category scheme='http://www.blogger.com/atom/ns#' term='Animation'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>3D projections in Silverlight 3 Beta – part 2</title><content type='html'>&lt;p&gt;In my previous post on &lt;a href="http://joanmiro.blogspot.com/2009/05/3d-projections-in-silverlight-3-beta.html" target="_blank"&gt;3D projections in Silverlight 3 Beta&lt;/a&gt;, I created a basic PhotoCube that had images on the faces of a rotating cube created using the new 2D/3D PlaneProjection capabilities available in Silverlight 3.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SjAzx3KCgzI/AAAAAAAAADo/9gRwzMw9FT0/s1600-h/BasicCube3.png"&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BasicCube" border="0" alt="BasicCube" src="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SjAzybqMLjI/AAAAAAAAADs/7ppFxNF3eoI/BasicCube_thumb1.png?imgmax=800" width="382" height="284" /&gt;&lt;/a&gt; &lt;a href="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SjAzy7YgALI/AAAAAAAAADw/5lIbYjQ76Q4/s1600-h/BasicPhotoCube7.png"&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BasicPhotoCube" border="0" alt="BasicPhotoCube" src="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SjAzzgv17hI/AAAAAAAAAD0/hwpaHZEkq-E/BasicPhotoCube_thumb5.png?imgmax=800" width="389" height="286" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I thought I’d do a bit more and add some animation to the cube’s rotation and also do away with the slider and rotate the cube using the mouse. I thought it would be nice if the cube rotated slowly all the time, regardless of any mouse interaction, so the first thing to do was to set up an animation to do that. Because I want to be able to manipulate this animation whilst the various mouse events are firing to allow me to control of the cube’s rotation independent of the ‘background’ rotation, I need to define it at the page level:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Storyboard &lt;/span&gt;slowStoryboard;&lt;br /&gt;&lt;span style="color: blue"&gt;readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;, &lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt; yRotations = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;, &lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt;();&lt;br /&gt;&lt;span style="color: blue"&gt;private double &lt;/span&gt;mouseStart;&lt;br /&gt;&lt;span style="color: blue"&gt;private bool &lt;/span&gt;mouseIsDown;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;PhotoCubePage()&lt;br /&gt;{&lt;br /&gt;    InitializeComponent();&lt;br /&gt;&lt;br /&gt;    SetUpRotations();&lt;br /&gt;    slowStoryboard = CreateSlowRotation();&lt;br /&gt;    slowStoryboard.Begin();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Storyboard &lt;/span&gt;CreateSlowRotation()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #2b91af"&gt;Storyboard &lt;/span&gt;newStoryboard = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Storyboard &lt;/span&gt;{ Duration = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Duration&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;.FromSeconds(15)) };&lt;br /&gt;    newStoryboard.RepeatBehavior = &lt;span style="color: #2b91af"&gt;RepeatBehavior&lt;/span&gt;.Forever; &lt;br /&gt;    &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;imageRotation &lt;span style="color: blue"&gt;in &lt;/span&gt;yRotations)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue"&gt;var &lt;/span&gt;animation = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DoubleAnimation &lt;/span&gt;{ Duration = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Duration&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;.FromSeconds(15)), BeginTime = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;(0) };&lt;br /&gt;        newStoryboard.Children.Add(animation);&lt;br /&gt;        &lt;span style="color: #2b91af"&gt;Storyboard&lt;/span&gt;.SetTarget(animation, (imageRotation.Key.Projection &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;));&lt;br /&gt;        &lt;span style="color: #2b91af"&gt;Storyboard&lt;/span&gt;.SetTargetProperty(animation, &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PropertyPath&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;(PlaneProjection.RotationY)&amp;quot;&lt;/span&gt;));&lt;br /&gt;        animation.To = imageRotation.Value + 360;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue"&gt;return &lt;/span&gt;newStoryboard;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;SetUpRotations()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Image &lt;/span&gt;image &lt;span style="color: blue"&gt;in &lt;/span&gt;ImageGrid.Children.Cast&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;&amp;gt;())&lt;br /&gt;    {&lt;br /&gt;        yRotations.Add(image, ((&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;)image.Projection).RotationY);&lt;br /&gt;        image.MouseLeftButtonDown += ImageMouseLeftButtonDown;&lt;br /&gt;        image.MouseLeftButtonUp += ImageMouseLeftButtonUp;&lt;br /&gt;        image.MouseMove += ImageMouseMove;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The animation is performed on each image as it will be for the mouse control, but a 15 second duration makes the cube turn slowly and I want a full rotation of 360 degrees. Setting the RepeatBehavior to Forever ensures that the animation doesn’t stop when it completes a complete rotation. The setup of the Dictionary of Images and their initial RotationY values has been moved to a method to tidy it up, and I now hook up the mouse events here as I need to respond to these on each image surface.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In the mouse down event I record the X-position of the mouse, pause the slow-moving animation and capture the mouse. In the mouse move event, I calculate the mouse movement in the Y-direction and do an rough calculation based on the width of a face of the cube and the amount of mouse movement, to decide on the animation of the faces of the cube which I feed into the cube animation method. In the mouse up event I release mouse capture and restart the slow rotation of the cube.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;ImageMouseLeftButtonDown(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;MouseButtonEventArgs &lt;/span&gt;e)&lt;br /&gt;{&lt;br /&gt;    mouseStart = e.GetPosition(&lt;span style="color: blue"&gt;this&lt;/span&gt;).X;&lt;br /&gt;    slowStoryboard.Pause();&lt;br /&gt;    mouseIsDown = ((&lt;span style="color: #2b91af"&gt;UIElement&lt;/span&gt;)sender).CaptureMouse();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;ImageMouseLeftButtonUp(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;MouseButtonEventArgs &lt;/span&gt;e)&lt;br /&gt;{&lt;br /&gt;    mouseIsDown = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;br /&gt;    ReleaseMouseCapture();&lt;br /&gt;    slowStoryboard = CreateSlowRotation();&lt;br /&gt;    slowStoryboard.Begin();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;ImageMouseMove(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;MouseEventArgs &lt;/span&gt;e)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue"&gt;if &lt;/span&gt;(mouseIsDown)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue"&gt;double &lt;/span&gt;mouseMovement = mouseStart - e.GetPosition(&lt;span style="color: blue"&gt;this&lt;/span&gt;).X;&lt;br /&gt;        &lt;span style="color: blue"&gt;double &lt;/span&gt;rotation = mouseMovement / FrontImage.Width * 90;&lt;br /&gt;        AnimateRotation(rotation, 1);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;AnimateRotation(&lt;span style="color: blue"&gt;double &lt;/span&gt;movement, &lt;span style="color: blue"&gt;double &lt;/span&gt;seconds)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue"&gt;var &lt;/span&gt;duration = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Duration&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;.FromSeconds(seconds));&lt;br /&gt;    &lt;span style="color: blue"&gt;var &lt;/span&gt;storyboard = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Storyboard &lt;/span&gt;{ Duration = duration };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;imageRotation &lt;span style="color: blue"&gt;in &lt;/span&gt;yRotations)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue"&gt;var &lt;/span&gt;animation = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DoubleAnimation &lt;/span&gt;{ Duration = duration, BeginTime = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;(10) };&lt;br /&gt;        storyboard.Children.Add(animation);&lt;br /&gt;        &lt;span style="color: #2b91af"&gt;Storyboard&lt;/span&gt;.SetTarget(animation, (imageRotation.Key.Projection &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;));&lt;br /&gt;        &lt;span style="color: #2b91af"&gt;Storyboard&lt;/span&gt;.SetTargetProperty(animation, &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PropertyPath&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;(PlaneProjection.RotationY)&amp;quot;&lt;/span&gt;));&lt;br /&gt;        animation.To = ((&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;)imageRotation.Key.Projection).RotationX + imageRotation.Value + movement;&lt;br /&gt;        animation.EasingFunction = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ElasticEase &lt;/span&gt;{ EasingMode = &lt;span style="color: #2b91af"&gt;EasingMode&lt;/span&gt;.EaseOut, Oscillations = 3, Springiness = 6 };&lt;br /&gt;&lt;span style="color: blue"&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;    storyboard.Begin();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Just so that all the code is shown, here is the fairly simple XAML for the page:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DarkGray&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ImageGrid&amp;quot; &amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FrontImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/silverlight.jpg&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LeftImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/OpenfeatureLizardSquare.jpg&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BackImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Waterfall.jpg&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;180&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RightImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Tulip.jpg&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;270&amp;quot;/&amp;gt;&lt;br /&gt;                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The result is that the cube turns slowly whilst the mouse is not being used to manipulate it and while the mouse is used to drag it the cube responds with animated movement; I use one of the pre-canned easing functions to give the animation a ‘springy’ feeling at the end of each movement. Notice that the animation method calculates the move-to value for each animation by adding the original position of the image/face to the movement value AND the current value of the RotationY which has been affected by the slow rotation.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And here’s the result:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:{7D7E1B1B-BB15-44b5-AC22-DF49F6B00FD3}:c28f967a-75a1-405d-8375-5ce809b98af2" class="wlWriterEditableSmartContent"&gt;   &lt;iframe src="http://silverlight.services.live.com/invoke/84825/PhotoCube/iframe.html" scrolling="no" frameborder="0" style="width:320px;height:240px" width="320" height="240"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You may have noticed that although I have called the thing I am rotating a cube and in the first post there were actually six images, I have done away with the top and bottom of my cube in the latest mark-up. This is because they are not really visible whilst the ‘cube’ is rotating on just the Y-axis; I had intended to make it a proper cube and allow rotation along 2 axes (which would have given me full articulation of the cube, or even 3 – to allow me to move the cube in and out of the screen), but there is a problem when it comes to allowing movement in more that one direction.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The problem lies in the fact that once an image plane has been rotated along one axis, rotation in another one happens in relation to the original position, not the new one, so that the faces that become the sides of the cube, the back of the cube, the top and the bottom all need to be transformed in different ways to maintain the illusion of a solid shape in 3D space. For example, after the original Y-axis rotation to setup the cube’s sides and the X-axis rotation to setup the cube’s top and bottom, to rotate the cube along the X-axis, the sides need to be rotated along the Z-axis (i.e. the one that runs through their centre) and this assumes that they aren’t transformed further in the Y-axis themselves, by a slider or my attempts at animating them with mouse movement. In fact the maths for calculating the positions of the faces of the cube are quite complex; from dipping into Charles Petzold’s book: &lt;a href="http://www.amazon.co.uk/3D-Programming-Windows-Pro-Developer/dp/0735623945/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1244671072&amp;amp;sr=8-1" target="_blank"&gt;3D Programming for Windows&lt;/a&gt; and quickly getting bogged down with quaternions and rotation matrices, it was clear the maths were beyond the scope of this post, so I chickened out and did away with the top and bottom of the cube and abandoned the notion of full articulation (for now). So we have ended up what might be better called a ‘PhotoPrism’ that rotates only along the Y-axis.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This new name did give me the idea for a further refinement of the cube: if the thing is a prism, there is no reason why it can’t have a variable number of faces, from 3 upwards – the maths for calculating the positioning and angles of rotation for the faces would be much easier. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hmm, watch this space…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-1164631839856251459?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/1164631839856251459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=1164631839856251459' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1164631839856251459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1164631839856251459'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/06/3d-projections-in-silverlight-3-beta.html' title='3D projections in Silverlight 3 Beta – part 2'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-8344080794076068512</id><published>2009-05-20T19:16:00.001+01:00</published><updated>2009-05-20T19:16:02.692+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='3D'/><category scheme='http://www.blogger.com/atom/ns#' term='Rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='Plane Projection'/><category scheme='http://www.blogger.com/atom/ns#' term='PhotoCube'/><category scheme='http://www.blogger.com/atom/ns#' term='Animation'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight 3'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>3D projections in Silverlight 3 Beta</title><content type='html'>&lt;p&gt;I had a quick play with the new Plane Projection feature in the Silverlight 3 beta. Like many others, my first experiments were with taking a rectangular image and flipping it around the X, Y &amp;amp; Z axes (these suffixes will be denoted by * for mentions of properties from now on to save typing the variants). It is useful to think of these as long poles running in the respective directions with objects being transformed around these ‘spindles’ using the &lt;font color="#ff0000"&gt;Rotation*&lt;/font&gt; properties&lt;em&gt;.&lt;/em&gt; The &lt;font color="#ff0000"&gt;CenterOfRotation* &lt;/font&gt;&lt;font color="#000000"&gt;properties allow a displacement from the centre of the axis so that an element traces a circle around an axis when rotated rather than flips on that axis, so:&lt;/font&gt;&lt;/p&gt;  &lt;pre class="code"&gt;        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Tulip.jpg&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Opacity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Leaves.jpg&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Opacity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;240&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Leaves.jpg&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Tulip.jpg&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;240&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Path &lt;/span&gt;&lt;span style="color: red"&gt;Data&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;M77,0 L77,154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Fill&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#FF000000&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;StrokeThickness&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stroke&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#FF000000&amp;quot; /&amp;gt; &lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Produces the following:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/ShRIwaM-5gI/AAAAAAAAADQ/f3jWGT6r0hs/s1600-h/PlaneProjectionSample18.png"&gt;&lt;img style="border-right-width: 0px; margin: 20px 0px 0px 70px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PlaneProjectionSample1" border="0" alt="PlaneProjectionSample1" src="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/ShRIzBjr1LI/AAAAAAAAADU/4MG5WlJZiZY/PlaneProjectionSample1_thumb6.png?imgmax=800" width="453" height="278" /&gt;&lt;/a&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The first 2 images rotate around the Y axis (I have added a Path line to mark its position and altered their opacity slightly to make things clearer), but the second 2 have had their Z positions (in and out of the screen, as it were) brought forward by 100 before being rotated around the Y axis. The grey background is the Grid that holds the images and you can see that the changes to the images’ projections can take them beyond their containing element.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Armed with this small amount of knowledge, I wanted to see if I could make a photocube and rotate it with animations or sliders so that the photos on all sides of the cube could be seen. Here’s the code:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ControlsPanel&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Y Rotation : &amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Slider &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;YSlider&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Minimum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Maximum&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;360&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;150&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ValueChanged&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;YSlider_ValueChanged&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ImageGrid&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FrontImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Front.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LeftImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Left.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BackImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Back.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;180&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RightImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Right.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;270&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TopImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Top.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationX&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;90&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BottomImage&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Visible&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;154&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/Bottom.png&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationZ&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-77&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RotationX&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;270&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PhotoCubePage &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;Page&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color: blue"&gt;readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;, &lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt; yRotations = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;, &lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt;(6);&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: blue"&gt;public &lt;/span&gt;PhotoCubePage()&lt;br /&gt;    {&lt;br /&gt;        InitializeComponent();&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Image &lt;/span&gt;image &lt;span style="color: blue"&gt;in &lt;/span&gt;ImageGrid.Children.Cast&amp;lt;&lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;&amp;gt;())&lt;br /&gt;        {&lt;br /&gt;            yRotations.Add(image, ((&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;)image.Projection).RotationY);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue"&gt;private void &lt;/span&gt;YSlider_ValueChanged(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedPropertyChangedEventArgs&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt; e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;imageRotation &lt;span style="color: blue"&gt;in &lt;/span&gt;yRotations)&lt;br /&gt;        {&lt;br /&gt;            ((&lt;span style="color: #2b91af"&gt;PlaneProjection&lt;/span&gt;) imageRotation.Key.Projection).RotationY = imageRotation.Value + ((&lt;span style="color: #2b91af"&gt;Slider&lt;/span&gt;) sender).Value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Produces the following:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/ShRIzxEtEMI/AAAAAAAAADY/SoW-2a2PRzE/s1600-h/BasicCube3.png"&gt;&lt;img style="border-right-width: 0px; margin: 20px 0px 0px 70px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BasicCube" border="0" alt="BasicCube" src="http://lh3.ggpht.com/_E_ZM9Y7o2Ow/ShRI0x3rC4I/AAAAAAAAADc/fA4jUC3UOzc/BasicCube_thumb1.png?imgmax=800" width="393" height="293" /&gt;&lt;/a&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I used basic images with text on them so I could verify the positioning and rotation of the cube’s sides, but it looks nicer with some images:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/ShRI2ZZC83I/AAAAAAAAADg/Advr7aIQ5l0/s1600-h/BasicPhotoCube3.png"&gt;&lt;img style="border-right-width: 0px; margin: 20px 0px 0px 70px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BasicPhotoCube" border="0" alt="BasicPhotoCube" src="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/ShRI4N0o_MI/AAAAAAAAADk/jkQOhIa7mDk/BasicPhotoCube_thumb1.png?imgmax=800" width="386" height="284" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Next time – some mouse handling to rotate the cube, some animation easing for the cube’s movement and why it is much harder to rotate the cube along more than one axis…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-8344080794076068512?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/8344080794076068512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=8344080794076068512' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8344080794076068512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8344080794076068512'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/05/3d-projections-in-silverlight-3-beta.html' title='3D projections in Silverlight 3 Beta'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-1879095322853169870</id><published>2009-03-19T21:52:00.001Z</published><updated>2009-03-19T22:25:24.958Z</updated><title type='text'>The new features in Silverlight 3 – 3D Projections</title><content type='html'>&lt;p&gt;Lots of interesting new stuff in the beta of Silverlight 3 – the 2D plane into 3D projection property that has been added to the UIElement class is obviously going to provide lots of opportunity to enhance control templates with mouse over and selected states in VSM. It is pretty easy to knock up a poor-man’s carousel type effect with a few buttons and a template with PlaneProjection transitions:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_E_ZM9Y7o2Ow/ScK-qp-6rmI/AAAAAAAAADI/qJF2hWZCDQI/s1600-h/QuickCarousel%5B8%5D.png"&gt;&lt;img style="border-right-width: 0px; margin: 20px 20px 20px 2px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="QuickCarousel" border="0" alt="QuickCarousel" src="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/ScK-rO_GC4I/AAAAAAAAADM/5mRkYhYu1pw/QuickCarousel_thumb%5B6%5D.png?imgmax=800" width="457" height="111" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ControlTemplate &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;      &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;grid&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PlaneProjection &lt;/span&gt;&lt;span style="color: red"&gt;CenterOfRotationY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Projection&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualStateManager.VisualStateGroups&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualStateGroup &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CommonStates&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualStateGroup.Transitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualTransition &lt;/span&gt;&lt;span style="color: red"&gt;GeneratedDuration&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;00:00:00.2000000&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;To&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MouseOver&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualTransition &lt;/span&gt;&lt;span style="color: red"&gt;From&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MouseOver&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;GeneratedDuration&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;00:00:00.5000000&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualStateGroup.Transitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualState &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Normal&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Storyboard&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DoubleAnimationUsingKeyFrames &lt;/span&gt;&lt;span style="color: red"&gt;BeginTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;00:00:00&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Duration&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;00:00:00.0010000&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Storyboard.TargetName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;grid&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Storyboard.TargetProperty&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;(UIElement.Projection).(PlaneProjection.RotationX)&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;EasingDoubleKeyFrame &lt;/span&gt;&lt;span style="color: red"&gt;KeyTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;00:00:00&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-85&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DoubleAnimationUsingKeyFrames&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Storyboard&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualState&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;vsm&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;VisualState &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MouseOver&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Storyboard&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;etc...      &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ControlTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;     &lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;400&amp;quot;&amp;gt;      &lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.Resources&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fred&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;FlipButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Barney&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;FlipButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wilma&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;FlipButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Betty&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;FlipButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Pebbles&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;FlipButton&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;p&gt;The key thing is to target the UIElement’s Projection.ProjectionPlane property and to animate its RotationX, RotationY and RotationZ properties to transform the 2D plane of the element in the X, Y &amp;amp; Z dimensions. Setting the CentreOfRotationX, CentreOfRotationY &amp;amp; CentreOfRotationZ properties determines when the movement ‘hinges’ and the rotations are in degrees from the normal, untransformed state (i.e. 0 degrees).&lt;/p&gt;  &lt;p&gt;Five minutes obviously doesn’t make for a control – but interesting to play with the effect and I expect to see it crop up in many a control and Silverlight app in the future.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-1879095322853169870?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/1879095322853169870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=1879095322853169870' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1879095322853169870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1879095322853169870'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/03/new-features-in-silverlight-3-3d.html' title='The new features in Silverlight 3 – 3D Projections'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-4760606151744422786</id><published>2009-01-12T23:35:00.001Z</published><updated>2009-01-13T11:17:15.494Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7 beta'/><category scheme='http://www.blogger.com/atom/ns#' term='Desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='WinForms'/><category scheme='http://www.blogger.com/atom/ns#' term='wallpaper'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Great Minds…</title><content type='html'>&lt;p&gt;Having joined the millions of others who have downloaded and installed the Windows 7 beta recently, I noticed that one of the new features is the ability to have the desktop wallpaper change automatically at selectable intervals. This is functionality that I implemented in a little app that I wrote a few years ago as a bit of a C#.NET learning exercise and put up on my website. I called it the Openfeature WallpaperChanger and it is available &lt;a href="http://www.openfeature.co.uk/download/WallpaperChanger.exe"&gt;here&lt;/a&gt;. &lt;a href="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SWvTylkW7LI/AAAAAAAAACc/6dVeALBpv04/s1600-h/WallpaperChanger%5B5%5D.jpg"&gt;&lt;img style="border-right-width: 0px; margin: 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="WallpaperChanger" border="0" alt="WallpaperChanger" align="right" src="http://lh5.ggpht.com/_E_ZM9Y7o2Ow/SWvTzHdZaZI/AAAAAAAAACg/2lD_Wt-GW3U/WallpaperChanger_thumb%5B3%5D.jpg?imgmax=800" width="199" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It allows you to pick a set of images to use as desktop wallpapers and set the interval after which the app will select the next one and make it the Windows wallpaper; it also allows you to randomise the order and set the tile/stretch options for filling the screen. I had always intended to rework it as a Vista gadget, but I guess there won’t be a need to if Microsoft are going to make the functionality a feature of the OS.&lt;/p&gt;  &lt;p&gt;This is not the first time this has happened either – I had a hunt around but couldn’t find a copy of an app I wrote some time in the early 1990s which consisted of a 2-3 pixel wide UI bar that docked to one side of the Windows desktop and slide out to a larger surface when the mouse was moved over it to reveal a notepad icon, a printer icon and a wastepaper basket icon. Dragging files from the File Manager to the bar and dropping them on one of the icons would allow viewing, printing or deleting them. This was Windows 3/3.11 Workgroups and predated Windows 95 and the auto-hide taskbar by a year or two.&lt;/p&gt;  &lt;p&gt;Now I’m not for a moment suggesting that Microsoft spies were snooping on my hobby developer activities on each of these occasions - the phrase “don’t flatter yourself, dear” comes to mind - but I do think certain ideas have their time and emerge spontaneously, meme-like, in more than one place at the same time.&lt;/p&gt;  &lt;p&gt;And I guess anyway that there will be plenty of people who will claim that these sorts of features were already in the Apple Mac OS for others to steal long before they appeared in Windows and there will be others still who don’t reckon much to UX features like auto-hide, or cycling wallpapers anyway so maybe “fools seldom differ”.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4760606151744422786?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4760606151744422786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4760606151744422786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4760606151744422786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4760606151744422786'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2009/01/great-minds.html' title='Great Minds…'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-8775415673310687312</id><published>2008-11-24T23:19:00.002Z</published><updated>2008-11-24T23:22:02.872Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Scale'/><category scheme='http://www.blogger.com/atom/ns#' term='Chord'/><category scheme='http://www.blogger.com/atom/ns#' term='XAML'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='Piano'/><title type='text'>Creating a Chord Factory in Silverlight 2</title><content type='html'>&lt;p&gt;Years ago I created a Windows Forms application that displayed piano chords and musical scales graphically as a sort of pet project/learning exercise. It was written in VB6.0 (I said it was years ago) and contained an image of a piano keyboard and a musical stave. Selecting a root note, either by clicking a key or using a ComboBox, and picking a chord and/or scale, it would show the notes in the chord and/or scale on the keyboard and on the stave. It is still available for download &lt;a href="http://www.openfeature.co.uk/download/chord.zip"&gt;here&lt;/a&gt; and will install and run under Vista - although as you can see from the image it fails to install the musical font used to display the clef symbols.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh6.ggpht.com/_E_ZM9Y7o2Ow/SSs2bHt2tHI/AAAAAAAAACU/2LIPqvvS3GM/s1600-h/ChordFactory%5B10%5D.png"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; MARGIN: 5px 10px 0px 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" border="0" alt="ChordFactory" align="left" src="http://lh4.ggpht.com/_E_ZM9Y7o2Ow/SSs2bo7KexI/AAAAAAAAACY/1nuUzybxqdY/ChordFactory_thumb%5B8%5D.png?imgmax=800" width="460" height="370" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;em&gt;The Openfeature Chord Factory main screen. &lt;/em&gt;That should be a &lt;span style="font-family:MusiSync;font-size:180%;"&gt;G &lt;/span&gt;&lt;span style="font-family:Trebuchet MS;"&gt;rather than an &lt;strong&gt;O&lt;/strong&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#404040;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;As well as showing chords it also harnessed the power of the Windows Multi Media API to play them using the MIDI synthesizer of the PC sound card or to an attached MIDI device. Over time I added further enhancements such as chord-inversions, chord progressions and a help file. I was and still am quite proud of it.&lt;/p&gt;&lt;p&gt;I recently decided to revisit Chord Factory after all these years and have a look at re-implementing it in Silverlight 2 - using XAML to achieve better graphical presentation of the piano keyboard and musical stave and data binding to better store and represent the musical data for the chord shapes and scales. I suspected that the lack of access to the Windows API would make it necessary to find another way of playing the chords, but thought the the Silverlight MediaElement might offer a way around this limitation.&lt;/p&gt;&lt;p&gt;It's not quite finished yet, but I thought it might make the subject of a few posts on how I did it  and I'm starting with this one. I have done quite a bit on it so far and the work-in-progress is already up on the web at my Openfeature web site &lt;a href="http://www.openfeature.co.uk/Silverlight/SilverlightChordFactory.html"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;More to come...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-8775415673310687312?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/8775415673310687312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=8775415673310687312' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8775415673310687312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8775415673310687312'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2008/11/creating-chord-factory-in-silverlight-2.html' title='Creating a Chord Factory in Silverlight 2'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-3027450357368679983</id><published>2008-11-24T16:51:00.004Z</published><updated>2008-11-24T17:10:14.950Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDE'/><category scheme='http://www.blogger.com/atom/ns#' term='designer'/><category scheme='http://www.blogger.com/atom/ns#' term='WinForms'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='attributes'/><category scheme='http://www.blogger.com/atom/ns#' term='property browser'/><title type='text'>20 Tips for Producing Releasable Controls</title><content type='html'>&lt;p&gt;I thought I would publish the slides from the presentation I put together for last year's Developer Day, on producing releasable controls. It covered attributing and enhancing custom and user controls in order to get them to a level good enough for public or commercial release.&lt;/p&gt;  &lt;p&gt;The slide deck is &lt;a href="http://www.openfeature.co.uk/download/slidedecks/TwentyTips.zip"&gt;here&lt;/a&gt;, but I thought I might also elaborate a bit with a write-up of the hand-written notes I had for presenting.&lt;/p&gt;  &lt;p&gt;The idea was to show how to bridge the gap between functional controls for WinForms, Web, WPF etc., that might be good enough for internal project use, and releasable ones that better support deployment and use in the Visual Studio toolbox with all the design-time support that makes a control easier and nicer to use. Simple attributes, extensions and practices that enhance a control to make it look and behave better when used by other developers. &lt;/p&gt;&lt;p&gt;The 20 tips are:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;/span&gt;The &lt;span style="color:#0080c0;"&gt;Description&lt;/span&gt; Attribute, &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;2.&lt;/span&gt;&lt;/strong&gt; The &lt;span style="color:#0080c0;"&gt;Category&lt;/span&gt; Attribute, &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;3.&lt;/span&gt;&lt;/strong&gt; The &lt;span style="color:#0080c0;"&gt;Browsable&lt;/span&gt; Attribute &lt;/em&gt;- Use these simple attributes to decorate a control's properties to affect how (and whether) they appear in the property browser of Visual Studio.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;4.&lt;/span&gt; &lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;ToolboxBitmap&lt;/span&gt; Attribute &lt;/em&gt;- Add a 16x16 bitmap to your project and reference it using this attribute to avoid the default cog toolbox image.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;5. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;DefaultValue&lt;/span&gt; Attribute, &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;6. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;ResetXxxx&lt;/span&gt; Method, &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;7. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;ShouldSerializeXxxx&lt;/span&gt; Method&lt;/em&gt; - This is how you enable the Reset option in the context menu for a property in the property browser and govern how that property's state is serialized into the designer code for a control. If you want to provide the ability to reset a property, then you need a default to reset it to and if you have a default property, what is the point in serializing the value of that property for a control instance in a form or page, if the property's value is the same as the default. The DefaultValue attribute allows you to set a default (which must be a literal value) and the two methods allow you to get around the need for the default to be a literal value which is often the case where a property's type is an enumeration or a stored value (often resource strings localisation resources). Having implemented these methods, the designer will magically call them when providing the reset functionality for the property browser and when serializing the state of the control.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;8. &lt;/span&gt;&lt;/strong&gt;Extend the &lt;span style="color:#0080c0;"&gt;DefaultValue&lt;/span&gt; Attribute&lt;/em&gt; - This is a refinement of the above approach to getting around the literal restriction on using DefaultValue. Here you roll your own version of the attribute that can take arguments to allow resource retrieval for the default value rather than a literal.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;9. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;DefaultProperty&lt;/span&gt; Attribute, &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;10. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;DefaultEvent&lt;/span&gt; Attribute&lt;/em&gt; - Determine which property is scrolled to and highlighted by default in the property browser and which event stub is generated when the control is double-clicked in the designer.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;11. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;ToolboxItemFilter&lt;/span&gt; Attribute&lt;/em&gt; - Used to restrict visibility of a control to particular designers in Visual Studio - if you use the Require value of the ToolboxItemFilterType enumeration then the control will only appear in the toolbox when that designer is open.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;12. &lt;/span&gt;&lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;Bindable&lt;/span&gt; Attribute, &lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;13. &lt;/span&gt;&lt;/strong&gt;Implement &lt;/em&gt;&lt;span style="color:#0080c0;"&gt;&lt;em&gt;INotifyPropertyChanged&lt;/em&gt;&lt;/span&gt;&lt;/em&gt; - These help the IDE with hints for the property browser when displaying bindable properties - marking a property as bindable means that you have undertaken to have implemented property change notification for it and ensures that it is included in the list of default binding properties at the top of the property browser.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;14. &lt;/span&gt;&lt;/strong&gt;The setter value comparison pattern&lt;/em&gt; - This simple pattern helps avoid unnecessarily exercising setter code and erroneously firing property changed events, by checking that the new value is actually different to the old value.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;15.&lt;/span&gt; &lt;/strong&gt;The &lt;span style="color:#0080c0;"&gt;RefreshProperties&lt;/span&gt; Attribute &lt;/em&gt;- If a change in one of your properties has an effect on the display of others in the property browser or the control's appearance on the design surface then you can use this attribute to signal to the IDE that the property browser should re-query all the property values of the control and/or repaint the control in the designer.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;16.&lt;/span&gt; &lt;/strong&gt;Use Sandcastle&lt;/em&gt; - Microsoft now makes available the toolset it uses for generating the MSDN reference and help files from XML documentation comments in code. You can use Sandcastle to produce professional docs from your control's XML comments (which of course you should be providing for the sake of intellisense support and the IDE Object Browser).&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;17. &lt;/span&gt;&lt;/strong&gt;Setup/Toolbox registration&lt;/em&gt; - This has perennially been an area of pain and confusion in the past and continues to be to this day. The links here point to sources of help, but the whole subject is inevitably bound up in permissions and issues with target machines and their configuration.&lt;/p&gt;  &lt;p&gt;&lt;span style="color:#0080c0;"&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;18. &lt;/span&gt;&lt;/strong&gt;TypeConverter&lt;/em&gt;&lt;span style="color:#000000;"&gt;&lt;em&gt; &lt;/em&gt;- Where your properties are not simple CLR types and the IDE does not know how to present and manage their values in the property browser you can supply one of the standard set of TypeConverters or indeed your own custom TypeConverter to help. In this example the property is a class instance with its own properties and using the ExpandableObjectConverter allows the IDE to know that it can 'drill-down' into the property to expose the property's own properties as an expanded list. TypeConverters specify to the IDE how to convert from a type to a string and back again so that the IDE knows how to serialise and present property values in the property browser window.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="color:#0080c0;"&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;19. &lt;/span&gt;&lt;/strong&gt;TypeEditor&lt;/em&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; - Where a property is not easily entered as a string from the property browser a TypeEditor can be used to provide a UI for setting the property. The IDE already has TypeEditors for types such as Color where it will drop down a selector dialog with tabs for system, web and custom colour selection. You can write your own TypeEditors for custom display and editing of your properties and use the TypeEditor attribute to indicate to the IDE that the property has a special editor to display for setting its value.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;&lt;em&gt;20. &lt;/em&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:#0080ff;"&gt;&lt;em&gt;Smart Tags&lt;/em&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; - Common tasks for a control sited on the designer surface can be accessed via a little right-arrow icon if you supply a list of tasks using the smart tags support available in the Visual Studio IDE. The two books I name-check there &lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;a href="http://www.amazon.co.uk/NET-Windows-Forms-Custom-Controls/dp/1590594398/ref=sr_1_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1227545331&amp;amp;sr=1-3"&gt;Pro .NET 2.0 Windows Forms and Custom Controls by Matthew MacDonald&lt;/a&gt; &lt;/em&gt;and &lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;a href="http://www.amazon.co.uk/Windows-Forms-Programming-Chris-Sells/dp/0321267966/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1227545444&amp;amp;sr=1-1"&gt;Windows Forms 2.0 Programming by Chris Sells and Michael Weinhardt&lt;/a&gt;&lt;/em&gt; contain good walkthroughs of how to set these up and provide the UI for them.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-3027450357368679983?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/3027450357368679983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=3027450357368679983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/3027450357368679983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/3027450357368679983'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2008/11/20-tips-for-producing-releasable.html' title='20 Tips for Producing Releasable Controls'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-2493265936796121071</id><published>2008-09-04T12:09:00.001+01:00</published><updated>2008-09-04T12:09:17.584+01:00</updated><title type='text'>Organising Silverlight XAML Resources</title><content type='html'>&lt;p&gt;I recently had to work through a large number of XAML files and rationalise the use of styles in a medium-size Silverlight application. &lt;/p&gt;  &lt;p&gt;The original files had been produced with Expression Blend, and although some effort had been put into reusing common features such as fonts and colours, the resulting XAML was a mixture of named styles used as static resources and inline setting of properties. There was also repetition of styles across files within the project both in name and in content.&lt;/p&gt;  &lt;p&gt;Styles with the same key within a resource hierarchy will override each other with the definition nearest the element winning out and it is easy, unintentionally, to quickly accumulate styles with the same contents but different keys unless you're careful.&lt;/p&gt;  &lt;p&gt;An obvious inclination in this sort of situation is to centralise everything and to eliminate all duplication in order to tidy up things up. Styles and other resources used in more than one page or control can be placed in the App.xaml file of an application and accessed as static resources from XAML across the project. In this way if a change is required to the house style, like changing to a new standard font or colour-scheme, a single change in the central resources and a recompile is all that is required for the changes to apply throughout the entire project. And don't forget that one resource can make use of another; so, for example, a font name can be declared as a named resource and all other style resources can reference it as a static resource:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Sys&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;HouseFont&amp;quot;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;  Verdana&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Sys&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Sys&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BigTextSize&amp;quot;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: #a31515"&gt;56&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Sys&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;String&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BigButtonStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontFamily&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;HouseFont&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontSize&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;BigTextSize&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;...&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;BigButtonStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;On the whole this works fine, and the really nice thing is that the resource management features in Expression Blend make using and maintaining the resources easy. When creating new styles in the designer you can opt to store them centrally and when editing styles or templates it is easy to apply previously saved resources and avoid adding ad hoc styling.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/JoanMiro154/SL_B2mBKT7I/AAAAAAAAABw/x_f4SHAyaso/s1600-h/BlendResources8.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" border="0" alt="BlendResources" src="http://lh3.ggpht.com/JoanMiro154/SL_B3BDL7NI/AAAAAAAAAB0/D_2MDYXUlW4/BlendResources_thumb6.jpg?imgmax=800" width="417" height="215" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;At the same time, however, it is important to bear in mind the intentions of the designer of the application's visuals - my first, over-rigorous attempts at eliminating duplication of styles where the property values were all the same led to some problems because I didn't realise that two styles with exactly the same contents could still be two &lt;strong&gt;&lt;em&gt;different&lt;/em&gt;&lt;/strong&gt; styles. Take this example, where two styles contain the same setters and values:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductDescriptionTextBlockStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TextBlock&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontFamily&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;HouseFont&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontSize&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;MediumTextSize&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;span style="color: blue"&gt;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;BrightTextColour&lt;/span&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TextWrapping&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NoWrap&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Key&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ThumbnailSubTitleTextBlockStyle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TargetType&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TextBlock&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontFamily&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;HouseFont&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FontSize&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;MediumTextSize&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Foreground&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;span style="color: blue"&gt;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;BrightTextColour&lt;/span&gt;}&amp;quot; /&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setter &lt;/span&gt;&lt;span style="color: red"&gt;Property&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TextWrapping&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NoWrap&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;I first assumed these were obvious candidates for merging and renaming to a single style for use on product descriptions and thumbnail subtitles, but &lt;em&gt;logically&lt;/em&gt; they are different, and to replace these two styles with a single generally named one locks the style of two conceptual &lt;em&gt;different&lt;/em&gt; areas of the look and feel together artificially and arbitrarily - what if the designer of the UI later decides that thumbnail subtitles should be italicised? Would she expect all product descriptions to appear in italics? Rather obviously not. Clearly if a style is needed in more than one place because common aspects of visual design appear through the pages of an application then it makes sense to store it centrally in the application's resources and reference it everywhere it is needed, but elements that &lt;em&gt;happen&lt;/em&gt; to have the same set of style properties but are not related to each other might have their styles stored centrally but they shouldn't have their styles merged arbitrarily.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;So whilst it is important to rationalise repetition of genuinely duplicate style definitions&lt;font color="#000000"&gt;&lt;/font&gt;, it is also important to realise that coincidence of content is not always equality of identity.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;Another lesson I learnt was that over-centralisation could become cumbersome; I began by collecting styles in a grand sweep through the application and depositing them all in the App.xaml file on the general principle that styles stored &lt;em&gt;centrally &lt;/em&gt;are available &lt;em&gt;everywhere&lt;/em&gt; throughout the application if required. But what if they aren't required &lt;em&gt;everywhere&lt;/em&gt;? What if styles are only of relevance to a particular page? As I progressed in my task I realised that general styles with names such as 'TitleTextBlock' occurred in several places with different setter content - moving them to a central location meant the need to rename them with prefixes to differentiate them and keep the compiler from objecting. &lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;Under these circumstances it proved important to establish whether they needed to be held centrally at all - if they were only used in a particular page then it seemed better to leave them there and obviate the need for a prefix. On the other hand if they were used in several places and yet still had a conflicting name then a prefix seemed appropriate but adding a prefix based on the page where it was originally found before moving it into App.xaml led to confusing results - why was a style called 'BuyIt_TitleTextBlock' being used in the PrintDetails page? In these circumstances it was important to establish if the style was truly serving the the same purpose in all the locations it was being used and if so to give it a more accurate name that described its purpose rather than where it originated - in this case I settled on 'SummaryTitleTextBlock'.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font color="#000000"&gt;Finally a word about the suffixes on style keys: as the names used in the style keys grew to include distinguishing qualifiers, their lengths became a bit unwieldy - 'ThumbnailSummaryTitleHyperlinkButtonStyle' for example, at 41 characters, is a getting bit long; and more importantly unnecessarily long - what actual useful information is conveyed by the inclusion of the 'HyperlinkButton' type when that is clear from the TargetType attribute in the declaration of the style? Similarly, the inclusion of the word 'Style' itself adds nothing that we don't already know - the fact is that either where the style is declared or where it is used, it will be clear to anyone reading the code, what it is and to which element type it applies. The only place where resources are seen 'out of context' as it were, is in the Resources view of Expression Blend and here a useful icon indicates the TargetType and the tooltip for each resource gives details of its type. As such it seemed reasonable to shorten resource keys to their descriptive parts with 'ThumbnailSummaryTitleHyperlinkButtonStyle' becoming merely 'ThumbnailSummaryTitle' - until I came up against two 'ThumbnailSummaryTitle' instances - one for a TextBlock and one for a HyperlinkButton in which case the reintroduction of the TargetType suffix was justified to distinguish the two styles.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px; display: inline" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6833e7fb-26d6-4105-b373-806de4e4ba3a" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight" rel="tag"&gt;Silverlight&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Styles" rel="tag"&gt;Styles&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Resources" rel="tag"&gt;Resources&lt;/a&gt;,&lt;a href="http://technorati.com/tags/XAML" rel="tag"&gt;XAML&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-2493265936796121071?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/2493265936796121071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=2493265936796121071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/2493265936796121071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/2493265936796121071'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2008/09/organising-silverlight-xaml-resources.html' title='Organising Silverlight XAML Resources'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-8413128517761606660</id><published>2008-08-26T22:27:00.001+01:00</published><updated>2008-08-26T22:27:43.294+01:00</updated><title type='text'>Travel By Thought: McCluskey - The Lost Album</title><content type='html'>&lt;p&gt;Looking through the Mini-Discs in my attic the other day I found the only surviving copy of a set of recordings I made over 10 years ago, when I was into writing and recording using computers and MIDI equipment.&lt;/p&gt;  &lt;p&gt;I wrote 18 pieces based on 'themes' from the music of Orchestral Manoeuvres in the Dark and named them after one of the group's two main members - Andy McCluskey.&lt;/p&gt;  &lt;p&gt;Listening to them after all this time, I am quite satisfied with the results - I only had a bedroom to record in, a few pieces of MIDI equipment and an Atari ST, but apart from the odd glitch here and there, the tracks still sound pretty reasonable efforts.&lt;/p&gt;  &lt;p&gt;Anyway, to prevent them being lost for another 10 or more years, I have put them up on my web site for my easy access and for the world to stumble across in the unlikely event that anyone else is interested:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.openfeature.co.uk/cnstrct/sound.htm"&gt;http://www.openfeature.co.uk/cnstrct/sound.htm&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-8413128517761606660?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/8413128517761606660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=8413128517761606660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8413128517761606660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/8413128517761606660'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2008/08/travel-by-thought-mccluskey-lost-album.html' title='Travel By Thought: McCluskey - The Lost Album'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-2120690314076431199</id><published>2007-11-07T21:25:00.000Z</published><updated>2007-11-07T21:37:30.924Z</updated><title type='text'>TechEd 2007 interim swag count</title><content type='html'>Third day of TechEd 2007 and the swag-count is modest:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;T-Shirts:&lt;/strong&gt; 4&lt;br /&gt;&lt;strong&gt;Baseball caps: &lt;/strong&gt;2&lt;br /&gt;&lt;strong&gt;Misc: &lt;/strong&gt;1 Swaggily Fortunes winners plaque, 2 Beer cosies, 1 inflatable microphone (discarded due to slow-puncture)&lt;br /&gt;&lt;br /&gt;The right-honourable &lt;a href="http://www.guysmithferrier.com/"&gt;GSF&lt;/a&gt; and I agree - not a vintage year...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-2120690314076431199?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/2120690314076431199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=2120690314076431199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/2120690314076431199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/2120690314076431199'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/11/teched-2007-interim-swag-count.html' title='TechEd 2007 interim swag count'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-6889016201449450639</id><published>2007-11-07T14:26:00.000Z</published><updated>2007-11-07T14:59:49.360Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='collection initializers'/><category scheme='http://www.blogger.com/atom/ns#' term='object initializers'/><category scheme='http://www.blogger.com/atom/ns#' term='TechEd 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='auto properties'/><title type='text'>Auto Properties &amp; Object/Collection initializers - the presenter's friend</title><content type='html'>From being here at TechEd2007, I have noticed one thing, if nothing else (actually I have noticed lots else) is that the presenters bashing out code in live demos love auto properties and the quick initialisation capabilities in C#3.0. It makes the job of getting straight down to the umpteenth&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;   from &lt;/span&gt;a &lt;span style="color:#000099;"&gt;in &lt;/span&gt;b &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;   &lt;span style="color:#000099;"&gt;where &lt;/span&gt;c &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;&lt;span style="color:#000000;"&gt;   &lt;/span&gt;select&lt;/span&gt; d&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;so much easier. A bit like using dynamic SQL, it saves time/errors when cutting code in front of a live audience, and so it has cropped up in loads of sessions.&lt;br /&gt;&lt;br /&gt;Coming from a coding environment where we produce web, win and ajax controls, however, I can't say that auto properties will be figuring much in my production code; for the one reason that they cannot be decorated with attributes. Attributes are essential when surfacing control properties for governing designtime stuff like visibility, serialisation and categorisation as well as runtime stuff like data binding. Even simple private member variables need stuff like this when they are encapsulated as public properties.&lt;br /&gt;&lt;br /&gt;The initializers on the other hand are an excellent labour-saving piece of &lt;span style="color:#000099;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#993300;"&gt;motsDuJour&lt;/span&gt;&lt;span style="color:#000099;"&gt;&amp;gt;&lt;/span&gt;Syntactical Sugar&lt;span style="color:#000099;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#993300;"&gt;motsDuJour&lt;/span&gt;&lt;span style="color:#000099;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;. Given that all that happens when the syntax is compiled is that the longer-winded versions of the constructs are created in IL, they can be seen as akin to the &lt;em&gt;using &lt;/em&gt;block's expansion to a &lt;em&gt;try-finally dispose &lt;/em&gt;construct in the corresponding IL. &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;Good stuff.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-6889016201449450639?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/6889016201449450639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=6889016201449450639' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/6889016201449450639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/6889016201449450639'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/11/auto-properties-objectcollection.html' title='Auto Properties &amp; Object/Collection initializers - the presenter&apos;s friend'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-5872715633041102234</id><published>2007-09-20T14:05:00.000+01:00</published><updated>2007-10-12T15:59:06.505+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='punctuation'/><category scheme='http://www.blogger.com/atom/ns#' term='apostrophe'/><title type='text'>Possession or omission with one exception - and that's all</title><content type='html'>Pointless, I know, but I'm going to get this off my chest...&lt;br /&gt;&lt;br /&gt;How is it that so many people cannot get the use of the apostrophe correct? The rules for its use are simple and have only one exception (example of which can be found in this sentence).&lt;br /&gt;&lt;br /&gt;Possession - "Joan's painting (noun)", "England's captain"&lt;br /&gt;Omission - "That's all folks", "Don't get me started", "Joan's painting (verb)"&lt;br /&gt;Exception - "It's a long way to Tipperary", "The rules for its use"&lt;br /&gt;&lt;br /&gt;And that's all - it's not for awkward plurals like abbreviations (&lt;em&gt;DVDs&lt;/em&gt; not &lt;em&gt;DVD's&lt;/em&gt;) or nouns ending in vowels (&lt;em&gt;casinos &lt;/em&gt;not &lt;em&gt;casino's&lt;/em&gt;)&lt;br /&gt;&lt;br /&gt;IT IS SO SIMPLE!&lt;br /&gt;&lt;br /&gt;I feel better for that...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-5872715633041102234?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/5872715633041102234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=5872715633041102234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/5872715633041102234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/5872715633041102234'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/09/possession-or-omission-with-one.html' title='Possession or omission with one exception - and that&apos;s all'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-1349121908051594073</id><published>2007-07-20T08:59:00.000+01:00</published><updated>2007-10-12T15:58:17.640+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CodePlex'/><category scheme='http://www.blogger.com/atom/ns#' term='AjaxControlToolkit'/><category scheme='http://www.blogger.com/atom/ns#' term='MSCUI'/><category scheme='http://www.blogger.com/atom/ns#' term='NHS'/><title type='text'>MSCUI - The Microsoft Health Common User Interface</title><content type='html'>Last week some of the fruits of the project I have been working on for the last 2 years at Microsoft UK, saw the public light of day as &lt;a href="http://www.mscui.com/"&gt;http://www.mscui.com/&lt;/a&gt; and &lt;a href="http://www.codeplex.com/mscui"&gt;http://www.codeplex.com/mscui&lt;/a&gt; went live.&lt;br /&gt;&lt;br /&gt;Microsoft have been working for some time now with the UK National Health Service to produce UI guidance for healthcare software and to produce a UI control toolkit for web and Windows development that embodies that design guidance.&lt;br /&gt;&lt;br /&gt;Primarily centred around patient safety and standardisation of common interface elements, the guidance and tools are intended for health care ISVs to help them quickly and consistently produce web and Windows applications that conform to UK NHS standards that aid patient safety.&lt;br /&gt;&lt;br /&gt;The stuff we devs have been working on - the web and Windows controls - are intended to enforce rules about formatting of information-display and standardising and validating the input of data to promote patient safety and reduce ambiguity. The web controls make use of AJAX and the Microsoft AjaxControlToolkit and both platforms share common specific data types and code for parsing input and standardisation of displayed information.&lt;br /&gt;&lt;br /&gt;The intention in going public is to give the work and its output wider exposure and to create a community for feedback and input into an ongoing process of developing and extending the design guidance documentation (primarily through the &lt;a href="http://www.mscui.com/"&gt;http://www.mscui.com/&lt;/a&gt; site) and practical support for it in the toolkit and again a community for feedback (through the &lt;a href="http://www.codeplex.com/mscui"&gt;http://www.codeplex.com/mscui&lt;/a&gt; site).&lt;br /&gt;&lt;br /&gt;Anyway, the sites themselves describe and explain it better than I can here, but it is nice to see a public release to some of the stuff we've been doing over the past few months; and hopefully some of the stuff we are doing now, and as we move on, will make it out into the community via the same or a similar route.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-1349121908051594073?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/1349121908051594073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=1349121908051594073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1349121908051594073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1349121908051594073'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/07/mscui-microsoft-health-common-user.html' title='MSCUI - The Microsoft Health Common User Interface'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-1038771497737504617</id><published>2007-07-19T10:47:00.001+01:00</published><updated>2007-07-19T10:49:28.529+01:00</updated><title type='text'>See what I mean?</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_E_ZM9Y7o2Ow/Rp8znuU3n_I/AAAAAAAAAAU/mPM69tXGrU0/s1600-h/Chinooks.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5088842861495427058" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_E_ZM9Y7o2Ow/Rp8znuU3n_I/AAAAAAAAAAU/mPM69tXGrU0/s320/Chinooks.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/_E_ZM9Y7o2Ow/Rp8ziuU3n-I/AAAAAAAAAAM/9-ignSRLJok/s1600-h/Merlins.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5088842775596081122" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_E_ZM9Y7o2Ow/Rp8ziuU3n-I/AAAAAAAAAAM/9-ignSRLJok/s320/Merlins.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-1038771497737504617?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/1038771497737504617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=1038771497737504617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1038771497737504617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1038771497737504617'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/07/see-what-i-mean.html' title='See what I mean?'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_E_ZM9Y7o2Ow/Rp8znuU3n_I/AAAAAAAAAAU/mPM69tXGrU0/s72-c/Chinooks.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-4414203073772395105</id><published>2007-07-19T10:23:00.000+01:00</published><updated>2007-07-19T10:28:06.758+01:00</updated><title type='text'>OH NO! Not the BBC as well!</title><content type='html'>I saw a piece on the BBC 10 o'clock news last about supplying new helicopters to the troop-effort in Afghanistan and couldn't believe my eyes as the graphics for the numbers and types of aircraft contained the loathsome "grocer's apostrophe": Merlin's, Chinook's etc. Good grief! Were all the literate staff at the BBC too busy panicking about cancelling phone-in competitions to proof-read the captions on their flagship news programme?&lt;br /&gt;&lt;br /&gt;Has anybody checked whether there are still ravens at the Tower of London?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4414203073772395105?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4414203073772395105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4414203073772395105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4414203073772395105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4414203073772395105'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/07/oh-no-not-bbc-as-well.html' title='OH NO! Not the BBC as well!'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-6533967495863930164</id><published>2007-06-28T17:57:00.001+01:00</published><updated>2007-06-28T17:57:01.483+01:00</updated><title type='text'>Technobile link</title><content type='html'>&lt;p&gt;The online version of my Guardian Technology Technobile article is &lt;a href="http://technology.guardian.co.uk/weekly/story/0,,2112678,00.html"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-6533967495863930164?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/6533967495863930164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=6533967495863930164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/6533967495863930164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/6533967495863930164'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/06/technobile-link.html' title='Technobile link'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-4989446939607615375</id><published>2007-06-26T10:51:00.001+01:00</published><updated>2007-06-26T10:51:17.430+01:00</updated><title type='text'>K&amp;R Slaves</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Warning: anyone reading this might want to do so with a mental IMHO tag around the whole thing.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Long-suffering friends and colleagues know that I make no secret of disliking the code formatting convention known as &lt;a href="http://en.wikipedia.org/wiki/Indent_style#K.26R_style"&gt;K&amp;amp;R style&lt;/a&gt; (after &lt;a href="http://en.wikipedia.org/wiki/Brian_Kernighan"&gt;Brian Kernighan&lt;/a&gt; &amp;amp; &lt;a href="http://en.wikipedia.org/wiki/Dennis_Ritchie"&gt;Dennis Ritchie&lt;/a&gt; and the code layout style first used in their seminal book &lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/The_C_Programming_Language_%28book%29"&gt;The C Programming Language&lt;/a&gt;&lt;/em&gt;). However, although I personally believe that this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="color: rgb(0,0,255)"&gt;function&lt;/span&gt; changeTarget(source){&lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (source === Targets.localTarget){&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; target = &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._get_target(source);&lt;br /&gt;        &lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.ops; i++){&lt;br /&gt;            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.ops[i].value === target){&lt;br /&gt;                &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._logs.selectedindex = i;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;span style="color: rgb(0,0,255)"&gt;else&lt;/span&gt;{&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.selectedIndex = -1;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.get_mode() === SourceMode.Extended){&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.addCssClass(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._popupElement, &lt;span style="color: rgb(163,21,21)"&gt;"Extended"&lt;/span&gt;);&lt;br /&gt;    }&lt;span style="color: rgb(0,0,255)"&gt;else&lt;/span&gt;{&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.removeCssClass(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._popupElement, &lt;span style="color: rgb(163,21,21)"&gt;"Extended"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;...is much less readable and understandable than this: &lt;/p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;function&lt;/span&gt; changeTarget(source)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (source === Targets.localTarget)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; target = &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._get_target(source);&lt;br /&gt;        &lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.ops; i++)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.ops[i].value === target)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.selectedindex = i;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;else&lt;br /&gt;&lt;/span&gt;    {&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._log.selectedIndex = -1;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.get_mode() === SourceMode.Extended)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.addCssClass(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._popupElement, &lt;span style="color: rgb(163,21,21)"&gt;"Extended"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: rgb(0,0,255)"&gt;else&lt;br /&gt;&lt;/span&gt;    {&lt;br /&gt;        &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.removeCssClass(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;._popupElement, &lt;span style="color: rgb(163,21,21)"&gt;"Extended"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;...I know that these things are a matter of preference and project/company standards.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;No, what really annoys me are the reasons some people cite for preferring K&amp;amp;R over BSD/Allman code layout and the actual origins of the style itself. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;There seem to be two main reasons people go for it - firstly they think it looks cool; as if making code look complicated and involved imparts some sort of geeky kudos - "look at that heavy-duty code! Must be pretty hairy stuff going on in there, best not to touch it or try to maintain it, best just to marvel at it" - however, as in the above examples, I'd go for clarity and readability any day because code shouldn't be "write-only" and needs to be comprehensible to others to allow for maintainability.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The second reason seems to be born of a "be like the big boys" motivation - "if its good enough for the giants of software like Kernighan and Ritchie, then who are we to argue?" and "all the code that comes out of the big guys at Microsoft is formatted that way", but hang on - a few issues: &lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The compacted style only emerged as a practicality of only having 80 column x 25 line displays and trying to get as much readable code into each screen or printed page as possible - we don't have that constraint anymore and who prints code listings these days anyway?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Kernighan and Ritchie never mandated or recommended that style - they were quite neutral in the original book about it: &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;"The position of braces is less important, although people hold passionate beliefs. We have chosen one of several popular styles. Pick a style that suits you, then use it consistently."&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Yet somehow the style has become a sort of holy gourd.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Kernighan and Ritchie's original use of the style was inconsistent, (again because of constraints); the original C language didn't allow for the compacted braces style on functions that took arguments and K&amp;amp;R were quite happy to be pragmatic about things and adopt a BSD/Allman style for these cases&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Microsoft's big boys don't always manage consistency either; whilst they ship the AjaxControlToolkit with lots of K&amp;amp;R style code in the JavaScript, their internal style and code review tools warn against elements of K&amp;amp;R styling when they appear in language files that the tools process (main example C#) and it is possible to fall foul of check-in policies for compliance with these code review tools on readability/maintainability grounds&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;Ultimately though, my point is that to go with K&amp;amp;R for reasons of emulation or hero-worship is spurious and slavish, and readability and comprehensibility are much better criteria by which to select a code formatting style and I will "take the Pepsi challenge" any day that BSD/Allman wins on that score - I might just have to wait for a few others to cast off their chains.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4989446939607615375?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4989446939607615375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4989446939607615375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4989446939607615375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4989446939607615375'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/06/k-slaves.html' title='K&amp;amp;R Slaves'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-1609256514638510035</id><published>2007-06-26T08:37:00.001+01:00</published><updated>2007-06-26T08:37:58.639+01:00</updated><title type='text'>The fight continues...</title><content type='html'>&lt;p&gt;The &lt;a href="http://www.guardian.co.uk/"&gt;Guardian&lt;/a&gt; say that they are going to publish a piece I wrote for their &lt;strong&gt;Technobile&lt;/strong&gt; column which is published each Thursday in the &lt;a href="http://technology.guardian.co.uk"&gt;Technology&lt;/a&gt; supplement. The article is an extended version of my rant about big corporations misspelling my surname in correspondence, which I &lt;a href="http://joanmiro.blogspot.com/2006/06/misnominalorthography.html"&gt;previously posted here&lt;/a&gt;. My main motivation in sending it to them is the hope that wider exposure might result in someone identifying the makers of the CRM software that seems to be responsible for propagating the spelling error to so many companies. Then I can write to them and direct my bile more effectively.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-1609256514638510035?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/1609256514638510035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=1609256514638510035' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1609256514638510035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/1609256514638510035'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/06/fight-continues.html' title='The fight continues...'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-5717410923151601389</id><published>2007-05-02T09:07:00.000+01:00</published><updated>2007-05-02T09:22:55.161+01:00</updated><title type='text'>(Active)ActiveSync</title><content type='html'>Update on syncing my Treo 750 PDA phone:&lt;br /&gt;&lt;br /&gt;There is at least additional software on the install CD to enable synching via Bluetooth - yeah right, like the Bluetooth stack is renowned for its rock-solid reliability and compatibility...&lt;br /&gt;&lt;br /&gt;Well I wasn't too hopeful, but after the usual multitude of notifications about this, that and the other Bluetooth device all with individual (uncertified - of course) drivers, I got everything installed; and it all works!&lt;br /&gt;&lt;br /&gt;Now, with only the occasional hiccup/lockup/Task Manager kill off (it is Bluetooth after all), I have a way of syncing and transferring stuff, albeit at modem speeds (well it is Bluetooth after all).&lt;br /&gt;&lt;br /&gt;So although I won't be moving too many large files over to use in Picsel's dinky PDF viewer or ripping any DVDs to its miniSD card, I do at least have a way of getting stuff on and off the thing and a way of backing it up.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-5717410923151601389?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/5717410923151601389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=5717410923151601389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/5717410923151601389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/5717410923151601389'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/05/activeactivesync.html' title='(Active)ActiveSync'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-7505273230117546994</id><published>2007-04-17T14:51:00.000+01:00</published><updated>2007-04-17T15:11:48.546+01:00</updated><title type='text'>(in)ActiveSync</title><content type='html'>Over the years I have owned one or two PDA-type mobile devices at various times, not really using them as the workhorses of office productivity that they are often portrayed as being, but more out of sporadic curiosity and out of an interest in their programmability.&lt;br /&gt;&lt;br /&gt;Recently I got a Treo 750 as a replacement for my mobile phone and as it also runs Windows Mobile 5.0, I find myself effectively with another PDA. This time there is more of a chance of it becoming a real everyday tool for me as it pretty successfully combines a mobile phone with PDA Pocket PC functionality.&lt;br /&gt;&lt;br /&gt;But, and here finally is my point, over the years ActiveSync has always been a bugbear in terms of reliability and stability of configuration and use - AND IT IS STILL NO BETTER IN ITS LATEST INCARNATION! Connected once, synched, never recognised again except as an USB device error. So now I am stuck trawling the forums looking for help in resolving the issue, un-installing/re-installing (didn't work), upgrading ActiveSync from 4.2 to 4.5 (didn't work), swapping to other USB ports and other machines (you've guessed it - didn't work)...&lt;br /&gt;&lt;br /&gt;...frustrating.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-7505273230117546994?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/7505273230117546994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=7505273230117546994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/7505273230117546994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/7505273230117546994'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/04/inactivesync.html' title='(in)ActiveSync'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6938791.post-4017449087057403325</id><published>2007-04-02T09:02:00.000+01:00</published><updated>2007-04-17T14:48:27.055+01:00</updated><title type='text'>Ah! Good old .net remoting...</title><content type='html'>Looking at some .net remoting code recently reminded me of just how confusing and frustrating using it can be.&lt;br /&gt;&lt;br /&gt;We were trying to diagnose why remoted events hooked up to a remoted object were failing after the standard 5 minutes initial lease time despite the fact that the remoted object had an overridden InitializeLifetimeService method that returned null - the standard way to setup an infinite lease on a remoted object.&lt;br /&gt;&lt;br /&gt;Using debug tracing and explicit lease management with a sponsor class, we could prove that the remoted object was not dying, but nevertheless the events that it was firing seemed to be disconnected after the initial 5 minutes and we were getting a standard remoting infrastructure exception stating that the remote object didn't exist or was disconnected. How could it be that the remote object had an infinite lease but the events it was firing didn't?&lt;br /&gt;&lt;br /&gt;The answer, as always with remoting, lay in understanding the hoops that the remoting infrastructure goes through in supporting cross-domain marshaling of calls, i.e. how it manages to make each side of the remoting relationship behave like it is communicating with a local instance of what is to either side, the remote object.&lt;br /&gt;&lt;br /&gt;The curious thing is that even when a object that is remotable (i.e. derives from MarshalByRefObject) is started by a client that is not itself remotable, if the remoted object calls back to the client (as it must in order to fire an event back), then the remoted object must do so via the remoting infrastructure by communicating with a transparent proxy/real proxy local to itself which then forward the call via remoting back to the client.&lt;br /&gt;&lt;br /&gt;In other words the client and server roles are reversed for this callback and there is effectively a remoted instance at the client to receive the call and it was this that was being created with the default 5 minute initial lease time.&lt;br /&gt;&lt;br /&gt;This of course begs a couple of questions - firstly: what is being created on the client side as the receiver of the events? It can't be the client itself because it already exists, stays alive after the 5 minutes are up and doesn't derive from MarshalByRefObject and so cannot have a leased lifetime anyway. Secondly: how could we avoid whatever it was from dying after its 5 minute lease expired?&lt;br /&gt;&lt;br /&gt;As it turned out the second question was easier to answer than the first, albeit with a somewhat inelegant solution.&lt;br /&gt;&lt;br /&gt;A simple call to set the LifetimeServices.LeaseTime static property to a very large figure (say 1000 days) within the client app's initialization, sets the initial lease time for any MarshalByRefObject subsequently created in its AppDomain (including the dynamically created proxy that was previously timing out at the default lease time of 5 minutes) to what is effectively an infinite lease (unless you want to go 27 years without shutting the client app down!)&lt;br /&gt;&lt;br /&gt;Of course a more elegant solution would be to actually have created our own client side MarshalByRefObject derived class to serve up the events to the client app and then to have overriden the InitializeLifetimeService method to return null as we do on the server side, but that really wasn't necessary as the only remoted functionality on the client end was the servicing of these events and we could safety define a long default lease for all remoted objects created in the AppDomain and achieve the same effect without another layer of indirection and the effort of creating and testing more code.&lt;br /&gt;&lt;br /&gt;As for the answer to the first question...that's more difficult to answer; from debugging, it is clear that there is a TransparentProxy created on the server side which is used to fire events back to the client side, but what it is connected to, through the Remoting framework, down at the client side is difficult to establish (although I must admit I didn't spend too much time trying, after establishing the easy fix solution) - all the client is attached to, is an event that may or may not fire depending on whether it is connected to a valid source or not.&lt;br /&gt;&lt;br /&gt;Perhaps someone more familiar with the Remoting framework knows more about the mechanics that go on under the hood when "doing events" on remotable objects and how non-remotable objects can effectively work as remote servers when the remote objects &lt;em&gt;they&lt;/em&gt; create need to fire events back to them; it would be interesting to know...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6938791-4017449087057403325?l=joanmiro.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://joanmiro.blogspot.com/feeds/4017449087057403325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=6938791&amp;postID=4017449087057403325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4017449087057403325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6938791/posts/default/4017449087057403325'/><link rel='alternate' type='text/html' href='http://joanmiro.blogspot.com/2007/04/ah-good-old-net-remoting.html' title='Ah! Good old .net remoting...'/><author><name>Joan Miro (aka Gordon Mackie)</name><uri>http://www.blogger.com/profile/10154076207056707301</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='06313427244500069577'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>