<?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' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6794504094781844422</id><updated>2011-11-28T13:05:55.868+13:00</updated><category term='OneNote'/><category term='Visual Studio 2008'/><category term='Website'/><category term='Silverlight'/><title type='text'>Dug Tech</title><subtitle type='html'>A journal of my software development projects, stuck out on the Web in the hopes that someone else can make some use of it.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dugtech.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dugtech.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dug</name><uri>http://www.blogger.com/profile/00535537264685709913</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6794504094781844422.post-2433546552156909701</id><published>2009-03-11T13:44:00.001+13:00</published><updated>2009-03-11T15:28:32.141+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight Project: WellyTime</title><content type='html'>&lt;p&gt;Over my career as a developer there have been a few times when everything about Windows development up and changed on me: such as in the early 90s, when message loops became events; and later, in the early 00s, when MFC became .NET. Each time the change was for the better, but it wasn't easy to make the fundamental change in viewpoint required. I'm getting the same feeling now as I'm working to grok &lt;a href="http://en.wikipedia.org/wiki/Silverlight"&gt;Silverlight&lt;/a&gt; and the &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;Windows Presentation Foundation&lt;/a&gt; (WPF).&lt;/p&gt;  &lt;p&gt;I've been reading about Silverlight and playing around with it ever since settling in Wellington for our sabbatical, but nothing teaches better than an honest-to-goodness project, so I've decided to pick a simple Silverlight application and take it from conception to implementation. I'm also going to describe the process here on this blog; partly because I've found it valuable for me when others do this, but mostly because I believe it enforces the learning process. So here goes.&lt;/p&gt;  &lt;h4&gt;Project WellyTime&lt;/h4&gt;  &lt;p&gt;On &lt;a href="http://www.drsteen.com/blogs/wellington/"&gt;our Wellington Blog&lt;/a&gt;, I have a simple little Google gadget that shows the current time in Wellington, NZ. It works just fine, except for two things: One, it doesn't say anything about being the time in Wellington, I have to put that outside of the control. Two, it has ads. They can be turned off, but still ... I'd rather not have them at all. So I figured a simple Silverlight app that showed the current time in Wellington would be a good starting point.&amp;#160; &lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_baNgUEfgokQ/Sbb-HM7jTXI/AAAAAAAAFSg/rZhfrKNBuCc/s1600-h/TimeGoogleGadget.jpg"&gt;&lt;img style="display: inline" alt="" src="http://4.bp.blogspot.com/_baNgUEfgokQ/Sbb-HM7jTXI/AAAAAAAAFSg/rZhfrKNBuCc/s320/TimeGoogleGadget.jpg" align="right" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://www.google.com/ig/directory?synd=open&amp;amp;source=ggls&amp;amp;num=24&amp;amp;url=http://www.canbuffi.de/gadgets/clock/clock.xml&amp;amp;output=html"&gt;original Google gadget&lt;/a&gt; I used on the website basically has the look that I want (see image at right): rounded rectangle behind, large text for the time, smaller text above and below for the date and (in my case) the city name. So my first job was to replicate this look &amp;amp; feel.&lt;/p&gt;  &lt;h4&gt;Outdated Thinking&lt;/h4&gt;  &lt;p&gt;Arranging the text is a pretty simple proposition: I knew I wanted either a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.grid%28VS.95%29.aspx"&gt;Grid&lt;/a&gt; control or a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel%28VS.95%29.aspx"&gt;StackPanel&lt;/a&gt; as my container. The &lt;strong&gt;Grid&lt;/strong&gt; adds a tiny bit of overhead (I think), but offers a little more versatility, and I don't think that &lt;strong&gt;StackPanel&lt;/strong&gt; can be the root node. So &lt;strong&gt;Grid&lt;/strong&gt; it was. But how to get the rounded rectangle behind it? That's where I made my first big mistake.&lt;/p&gt;  &lt;p&gt;The code that I started with looked something like this:&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;UserControl &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;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;WellyTime.Step1&amp;quot;
    &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;/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;/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;120&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &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;MainCanvas&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;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Rectangle &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;BackgroundRect&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Fill&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Blue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RadiusX&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RadiusY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&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;120&amp;quot; /&amp;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;MainGrid&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ShowGridLines&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&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;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;120&amp;quot;&amp;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;
                &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;Auto&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;MinHeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;18&amp;quot; /&amp;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;
                &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;Auto&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;MinHeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;18&amp;quot; /&amp;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;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot; /&amp;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;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &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;DateText&amp;quot;
            &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wednesday, September 29, 2009&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&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;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&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;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &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;TimeText&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;36&amp;quot;
            &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12:00 PM&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&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;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&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;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; /&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &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;CityText&amp;quot;
            &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wellington, New Zealand&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&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;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&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;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;

        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;That works okay, and gives us what you see below, Which is pretty close, considering I’ve not put any gradients on the rectangle fill.&lt;/p&gt;

&lt;p&gt;(NOTE: In order to get this size, I had to change the default HTML test page so that the control’s containing DIV had a specific width &amp;amp; height set.&amp;#160; Otherwise, the width would be the webpage width.)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_baNgUEfgokQ/Sbcgdh3tVXI/AAAAAAAAFSs/1qKssobFiWc/s1600-h/image%5B6%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="127" alt="image" src="http://lh6.ggpht.com/_baNgUEfgokQ/SbcgexFDYlI/AAAAAAAAFSw/_Eu-swjq9-o/image_thumb%5B2%5D.png?imgmax=800" width="207" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;But all those Width=”200” Height=”120” attributes set my developer senses tingling.&amp;#160; I’d like to have my little Silverlight control fill up the space it’s been given; and the same goes for the Grid within and the background rectangle.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;UserControl&lt;/strong&gt; that is my application and the &lt;strong&gt;Grid&lt;/strong&gt; are easy: if you leave off the Width and Height attributes, they default to &lt;strong&gt;Double.NaN&lt;/strong&gt;, or “Auto” in XAML, which means “as large as your container”.&amp;#160;&amp;#160; (See &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.width(VS.95).aspx"&gt;this MDN page&lt;/a&gt; for details.)&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Rectangle&lt;/strong&gt; is another matter, though.&amp;#160; Its width and height seem to default to zero, even though they are ostensibly inherited from the same &lt;strong&gt;FrameworkElement&lt;/strong&gt; class that the &lt;strong&gt;UserControl&lt;/strong&gt; and &lt;strong&gt;Grid&lt;/strong&gt; are.&lt;/p&gt;

&lt;p&gt;Since I was still thinking old-school, I started by resizing the rectangle whenever I got a &lt;strong&gt;SizeChanged&lt;/strong&gt; event from the &lt;strong&gt;Canvas&lt;/strong&gt;.&amp;#160; Again, it worked, but didn’t seem like the best way to go.&amp;#160; Then, as I was stumbling around looking for something else, I found someone who’d added a &lt;strong&gt;Border&lt;/strong&gt; to their &lt;strong&gt;Grid&lt;/strong&gt;.&amp;#160; Ah ha!&lt;/p&gt;

&lt;h4&gt;Using the Grid Border&lt;/h4&gt;

&lt;p&gt;The key to understanding this aspect of the WPF/Silverlight paradigm shift is to think of the design elements (such as background) as &lt;em&gt;part of the controls themselves&lt;/em&gt;.&amp;#160; I don’t really want a rounded rectangle behind a grid; I want a grid whose background is a rounded rectangle.&lt;/p&gt;

&lt;p&gt;I added a &lt;strong&gt;Border&lt;/strong&gt; node within the &lt;strong&gt;Grid &lt;/strong&gt;and after a little fooling around with the fill values, I managed to produce this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_baNgUEfgokQ/SbcgfyqGcQI/AAAAAAAAFS0/8--KmzTenro/s1600-h/image%5B9%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="126" alt="image" src="http://lh4.ggpht.com/_baNgUEfgokQ/SbcghIAgfnI/AAAAAAAAFS4/WbSmNi9S9gM/image_thumb%5B3%5D.png?imgmax=800" width="204" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Nice, huh?&amp;#160; The beauty is: that’s not a &lt;strong&gt;Rectangle&lt;/strong&gt;.&amp;#160; It’s a &lt;strong&gt;Grid&lt;/strong&gt;.&amp;#160; But that &lt;strong&gt;Grid&lt;/strong&gt; has the following code within it:&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;Border &lt;/span&gt;&lt;span style="color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LightBlue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;CornerRadius&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&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;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.RowSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Border.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RadialGradientBrush 
            &lt;/span&gt;&lt;span style="color: red"&gt;Center&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.5,0.5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;GradientOrigin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.10,0.25&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;RadiusX&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.85&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;RadiusY&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1.25&amp;quot; 
            &lt;/span&gt;&lt;span style="color: red"&gt;Opacity&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1.0&amp;quot;
            &lt;/span&gt;&lt;span style="color: red"&gt;SpreadMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Pad&amp;quot; &amp;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;LightBlue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0.0&amp;quot;/&amp;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;Blue&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Offset&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1.0&amp;quot;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;RadialGradientBrush&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Border.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Border&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Then I threw in another border (cool!) right underneath that one.&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;Border &lt;/span&gt;&lt;span style="color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Black&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;CornerRadius&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&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;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.RowSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;3&amp;quot; /&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;That gave me a nice black outline.&amp;#160; I &lt;em&gt;love&lt;/em&gt; it that you can add borders one after another with the understanding that – like anywhere else in Silverlight – the later one is displayed on top of the previous one.&amp;#160; Take that, CSS!&lt;/p&gt;

&lt;p&gt;After adding back in the text, setting sizes and whatnot, I ended up with something that looks pretty nice (nicer even than the original I was copying, IMHO):&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_baNgUEfgokQ/SbcgiGorHcI/AAAAAAAAFS8/T0IgCOysYqk/s1600-h/image%5B12%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="92" alt="image" src="http://lh3.ggpht.com/_baNgUEfgokQ/SbcgjRxG0vI/AAAAAAAAFTA/a1Q266GVtU8/image_thumb%5B4%5D.png?imgmax=800" width="234" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;(NOTE: I changed the sizes a bit on the test HTML page to make this look right.&amp;#160; I’m now at 225px wide and 85px high for the wrapping DIV.)&lt;/p&gt;

&lt;p&gt;You can find the .xaml and .xaml.cs files for this &lt;a href="http://www.drsteen.com/blogs/dugtech/codesamples/wellytime/step2.zip"&gt;my WellyTime code directory&lt;/a&gt;.&amp;#160; That’s just those files for now; I’ll upload the whole project when I’m done.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6794504094781844422-2433546552156909701?l=dugtech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dugtech.blogspot.com/feeds/2433546552156909701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6794504094781844422&amp;postID=2433546552156909701&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/2433546552156909701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/2433546552156909701'/><link rel='alternate' type='text/html' href='http://dugtech.blogspot.com/2009/03/silverlight-project-wellytime.html' title='Silverlight Project: WellyTime'/><author><name>Dug</name><uri>http://www.blogger.com/profile/00535537264685709913</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_baNgUEfgokQ/Sbb-HM7jTXI/AAAAAAAAFSg/rZhfrKNBuCc/s72-c/TimeGoogleGadget.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6794504094781844422.post-7692640663008178588</id><published>2009-03-10T13:40:00.004+13:00</published><updated>2009-03-11T13:51:32.597+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='OneNote'/><title type='text'>VSTO and Visual Studio Standard Edition ... Solution</title><content type='html'>In a &lt;a href="http://dugtech.blogspot.com/2009/03/vsto-and-visual-studio-standard-edition.html"&gt;previous post&lt;/a&gt;, I described how annoying it was that Microsoft wanted to keep me from improving their OneNote application, even though I have a legal copy of both it &lt;span style="font-style: italic"&gt;and &lt;/span&gt;Visual Studio 2008. I should have mentioned that I understand completely if they want to put the &lt;a href="http://en.wikipedia.org/wiki/Visual_Studio_Tools_for_Office"&gt;Visual Studio Tools for Office&lt;/a&gt; (VSTO) into the Professional Edition and not the Standard Edition. That's their right, even if I think it's stupid. But I was surprised that they would keep people from using the API (which, after all, is just part of a set of DLLs), even if we hadn't purchased the specialized tools. .NET applications, for example, can be &lt;a href="http://www.builderau.com.au/program/dotnet/print.htm?TYPE=story&amp;amp;AT=339194364-339028399t-320002019c"&gt;written, compiled &amp;amp; run&lt;/a&gt; without purchasing any version of Visual Studio. Well, it turns out you &lt;span style="font-style: italic"&gt;can &lt;/span&gt;write applications that use the new API &lt;span style="font-style: italic"&gt;without&lt;/span&gt; having VSTO; it just takes a little more effort.   &lt;br /&gt;  &lt;br /&gt;Generally, in the .NET world, if you want to use someone's API, you just reference their DLL. In Visual Studio, this is pretty straight-forward: Right-click on the References folder, choose &amp;quot;Add Reference...&amp;quot; and either find it in the list of .NET references or browse for the standalone DLL. In fact, that's exactly what &lt;a href="http://elhombre.members.winisp.net/api/How%20to%20Create%20a%20OneNote%20Toolbar%20Addin.pdf"&gt;this very useful PDF document about creating a OneNote plug-in&lt;/a&gt; and this &lt;a href="http://msdn.microsoft.com/en-us/library/ms788684.aspx"&gt;two-part introduction to using the OneNote API&lt;/a&gt; suggest. Unfortunately, neither the .NET reference nor the COM reference appeared among my choices. So I went hunting for the DLLs.   &lt;br /&gt;  &lt;br /&gt;This is where I ran into trouble. The Microsoft Office 2007 API DLLs are officially called &amp;quot;Primary Interop Assemblies&amp;quot; (PIA) because they facilitate the inter-operation between your application and the vendor's application (in this case, the Microsoft Office applications). When you install Office 2007, these assemblies (Microsoft.Office.Interop.OneNote.dll and the like) are installed in the &lt;a href="http://en.wikipedia.org/wiki/Global_assembly_cache"&gt;Global Assembly Cache&lt;/a&gt; (GAC), but can't be found in Vista. Nor could I find them on the Web. VSTO, I'm told, installs some copies for you to use during development, but that didn't help me since I didn't have VSTO.   &lt;br /&gt;  &lt;br /&gt;After much searching (and cursing), I finally realized that I didn't actually &lt;span style="font-style: italic"&gt;need&lt;/span&gt; the DLLs. The APIs are in the GAC, so if I could get my project to reference those, I'd be fine. So I downloaded an open-source project for OneNote (&lt;a href="http://flimflan.com/blog/OneNoteDevPal.aspx"&gt;the OneNote DevPal&lt;/a&gt;) and opened its project file (.csproj) in notepad. I copied the ItemGroup information pertaining to the OneNote reference out of that file and into my own .csproj file by hand. Then, when I re-opened my own little test add-in, everything was hunky dory.   &lt;br /&gt;  &lt;br /&gt;The XML that I copied looked something like this:   &lt;br /&gt;  &lt;div class="CodeSample"&gt;&amp;lt;itemgroup&amp;gt;    &lt;br /&gt;&amp;lt;reference include=&amp;quot;Office, Version=12.0.0.0&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;private&amp;gt;False&amp;lt;/private&amp;gt;     &lt;br /&gt;&amp;lt;/reference&amp;gt;     &lt;br /&gt;&amp;lt;reference include=&amp;quot;Microsoft.Office.Interop.OneNote, Version=12.0.0.0&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;private&amp;gt;False&amp;lt;/private&amp;gt;     &lt;br /&gt;&amp;lt;/reference&amp;gt;     &lt;br /&gt;&amp;lt;reference include=&amp;quot;stdole&amp;quot;&amp;gt;     &lt;br /&gt;&amp;lt;private&amp;gt;False&amp;lt;/private&amp;gt;     &lt;br /&gt;&amp;lt;/reference&amp;gt;     &lt;br /&gt;&amp;lt;/itemgroup&amp;gt; &lt;/div&gt;  &lt;br /&gt;With that little bit of hackery, I was finally able to construct my own test add-in based on &lt;a href="http://blogs.msdn.com/descapa/archive/2006/08/31/734298.aspx"&gt;Dan Escapa's guide&lt;/a&gt;. If you're interested in creating OneNote add-ins, I suggest you start there as well. Keep in mind some errata, however:   &lt;br /&gt;  &lt;br /&gt;* When it says &amp;quot;YOUR GUID&amp;quot;, it means a &lt;span style="font-style: italic"&gt;new&lt;/span&gt; GUID created specifically for the add-in. Don't use the project GUID, or anything else generated by VS2008. (VS2008 can create GUIDs for you, btw; just look under the Tools menu.)   &lt;br /&gt;  &lt;br /&gt;* You'll have to run Visual Studio 2008 as an administrator (right-click the shortcut, choose &amp;quot;Run as Administrator&amp;quot;) if you're in Vista. I think that's due to the modification of the registry that the Setup project performs.   &lt;br /&gt;  &lt;br /&gt;Have fun!     &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6794504094781844422-7692640663008178588?l=dugtech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dugtech.blogspot.com/feeds/7692640663008178588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6794504094781844422&amp;postID=7692640663008178588&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/7692640663008178588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/7692640663008178588'/><link rel='alternate' type='text/html' href='http://dugtech.blogspot.com/2009/03/vsto-and-visual-studio-standard-edition_10.html' title='VSTO and Visual Studio Standard Edition ... Solution'/><author><name>Dug</name><uri>http://www.blogger.com/profile/00535537264685709913</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6794504094781844422.post-8732575627839808527</id><published>2009-03-10T12:19:00.004+13:00</published><updated>2009-03-10T12:41:44.624+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OneNote'/><title type='text'>VSTO and Visual Studio Standard Edition ... Complaining</title><content type='html'>A long, long time ago I read Guy Kawasaki's book &lt;a href="http://www.guykawasaki.com/books/macway.shtml"&gt;The Macintosh Way&lt;/a&gt;.  It was a decent read, if I remember correctly, but the one item that really stuck with me was an experiment that he did.  In an attempt to see how large companies handled potential "evangelists" (people excited about their products), he called a dozen or so companies and said to them, "I like your product.  How can I help sell it?"  Some companies, like Harley Davidson and Macintosh, were all over it: they had user groups or fan clubs and knew exactly how to get people in touch with others who wanted to spread the word.  Other companies (IBM, I think, and Microsoft to be sure) were simply flummoxed by the proposition.

This is what came to mind last night as I was trying to figure out how to extend Microsoft OneNote so as to better meet my needs.  Sara &amp;amp; I are working on organizing our lives (using &lt;a href="http://www.amazon.com/Take-Back-Your-Life-Microsoft%C2%AE/dp/0735620407"&gt;Take Back Your Life&lt;/a&gt; and &lt;a href="http://www.amazon.com/Getting-Things-Done-Stress-Free-Productivity/dp/0142000280/ref=pd_bxgy_b_img_b"&gt;Getting Things Done&lt;/a&gt;), and as part of that we're trying to figure out what tools will best work for our new organizational structures.  Outlook is fine as far as it goes, but I really like OneNote.  It's almost, &lt;span style="font-style: italic;"&gt;almost&lt;/span&gt; exactly what I need.

So I figured, hey, I'm a developer.  And I know that Microsoft has a OneNote API.  I'll just create a little plug-in that completes OneNote for me.  And what the heck, I might as well offer it to others, just to show them how useful OneNote can be.

Except it's not that easy.  It turns out that what you need to write Office plug-ins (and therefore OneNote plug-ins) is something called &lt;a href="http://en.wikipedia.org/wiki/Visual_Studio_Tools_for_Office"&gt;Visual Studio Tools for Office&lt;/a&gt;.  So that's cool.  I use Visual Studio 2008.  Except I use the Standard Edition, and VSTO doesn't come with the Standard Edition.  So fine, it's probably worth it to me &amp;amp; I can expense it: I'll just purchase and/or download VSTO as a standalone item.  Except it's not available as a standalone.  The upshot is: Here I am, someone who wants to enhance the functionality of a Microsoft product and offer it out to the world with the &lt;span style="font-style: italic;"&gt;express intention&lt;/span&gt; of making OneNote more useful, someone who's willing to do this for free, someone who's willing to spend several hours one night just to figure out &lt;span style="font-style: italic;"&gt;how to get started&lt;/span&gt; and I can't do it.  I have official, paid-for copies of Office 2007 and Visual Studio 2008, and I'd like to use them together.  But I get not only no help but actual obstacles thrown in my path from Microsoft.

Alright, so I finally figured out how to make it work, even &lt;span style="font-style: italic;"&gt;without&lt;/span&gt; VSTO.  So I'll proceed.  My next post will follow up the complaining with an actual solution.  But dang: How stupid is that?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6794504094781844422-8732575627839808527?l=dugtech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dugtech.blogspot.com/feeds/8732575627839808527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6794504094781844422&amp;postID=8732575627839808527&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/8732575627839808527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/8732575627839808527'/><link rel='alternate' type='text/html' href='http://dugtech.blogspot.com/2009/03/vsto-and-visual-studio-standard-edition.html' title='VSTO and Visual Studio Standard Edition ... Complaining'/><author><name>Dug</name><uri>http://www.blogger.com/profile/00535537264685709913</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6794504094781844422.post-9171828839595502779</id><published>2009-03-10T12:16:00.003+13:00</published><updated>2009-03-10T12:19:02.045+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website'/><title type='text'>Introduction</title><content type='html'>I've been meaning to create a professional blog for some time, and I realized today that if I don't do it soon, I'll have such a backlog of software development work from projects that I've started that I'll never get around to it.  So after playing around with some fancy-schmancy templates, I finally gave up and picked a serviceable Blogger template and ran with it.

I suppose "Find a better looking template" has to go on my to-do list now, eh?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6794504094781844422-9171828839595502779?l=dugtech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dugtech.blogspot.com/feeds/9171828839595502779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6794504094781844422&amp;postID=9171828839595502779&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/9171828839595502779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6794504094781844422/posts/default/9171828839595502779'/><link rel='alternate' type='text/html' href='http://dugtech.blogspot.com/2009/03/introduction.html' title='Introduction'/><author><name>Dug</name><uri>http://www.blogger.com/profile/00535537264685709913</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
