<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://mtaulty.com/CommunityServer/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mike Taulty's Blog</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/default.aspx</link><description>Bits and Bytes</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>Visual Studio 2010 Resources</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/20/10923.aspx</link><pubDate>Thu, 20 Nov 2008 12:45:27 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10923</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10923.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10923</wfw:commentRss><description>&lt;p&gt;This post is a companion to a little article that I wrote for the &lt;a href="http://msdn.microsoft.com/en-gb/flash/default.aspx"&gt;UK MSDN Flash&lt;/a&gt; about Visual Studio 2010 with some resources to get you kick-started. It's not meant to be definitive.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;What? You don't read the MSDN Flash? &lt;a href="http://msdn.microsoft.com/en-gb/flash/default.aspx"&gt;Sign up&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The first thing I'd say is that you need to take a look at this area on Channel9 and subscribe to it;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://channel9.msdn.com/VisualStudio/" href="http://channel9.msdn.com/VisualStudio/"&gt;http://channel9.msdn.com/VisualStudio/&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and also check out the &lt;strong&gt;Visual Studio 2010 and .NET Framework V4.0 week&lt;/strong&gt; here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://channel9.msdn.com/posts/VisualStudio/Visual-Studio-2010-and-the-NET-Framework-40-Week/" href="http://channel9.msdn.com/posts/VisualStudio/Visual-Studio-2010-and-the-NET-Framework-40-Week/"&gt;http://channel9.msdn.com/posts/VisualStudio/Visual-Studio-2010-and-the-NET-Framework-40-Week/&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If you're looking for a CTP to download then you need to look here - it's in VPC form and it's big so download over a weekend or something;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?familyid=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?familyid=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and there's a preview of the VS 2010 Training Kit (demos, labs, presentations) which you can get from here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyId=752CB725-969B-4732-A383-ED5740F02E93&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=752CB725-969B-4732-A383-ED5740F02E93&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=752CB725-969B-4732-A383-ED5740F02E93&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If you're looking at &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; then here's some places I'd go to;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/emea/teched2008/developer/tv/default.aspx?vid=23"&gt;Watch Jason Zander's keynote session at TechEd Europe&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/KYN02/"&gt;Watch Scott Guthrie's keynote at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL48/"&gt;Take a look at what's coming for web developers with Jeff King at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL32/"&gt;Understand the new IDE customisation opportunities with Tim Wagner at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If you want to understand the side-by-side story and features in the &lt;strong&gt;V4.0 CLR&lt;/strong&gt; then;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/PC49/"&gt;Check out the CLR Futures talk with Josh Goodman from PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL02/"&gt;See where the type system is going with Andrew Whitechapel at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If you want to check out what's coming in the &lt;strong&gt;languages&lt;/strong&gt; with Visual Studio 2010 then;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL16/"&gt;Listen to Anders Hejlsberg talk about C# 4.0 at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL12/"&gt;Listen to Paul Vick talk about VB 10 at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL11/"&gt;Listen to Luca Bolognese talk about F# at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL13/"&gt;Take a look at C++ in VS2010 with Boris Jabes at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If you want to know more about what's coming in the &lt;strong&gt;.NET Framework 4.0&lt;/strong&gt;;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Parallel Programming&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/emea/teched2008/developer/tv/default.aspx?vid=59"&gt;Take a look at Daniel Moth's Parallel Extensions session at TechEd EMEA&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;WPF&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/PC46/"&gt;Watch the WPF Roadmap with Kevin Gjerstad at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL36/"&gt;Check out what's coming in XAML 2009 with Rob Relyea at PDC&lt;/a&gt; (not strictly WPF specific but a lot of fun nonetheless :-))&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;WF and WCF&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL17/"&gt;Take a look at Workflow Foundation 4.0 with Kenny Wolf at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL21/"&gt;Look at the new model for Workflow activities with Matt Winkler at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL06/"&gt;Look at how WCF and WF come together with Ed Pinto at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Web&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/PC20/"&gt;Watch the ASP.NET 4.0 Roadmap with Scott Hunter at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/PC32/"&gt;Watch the ASP.NET AJAX Futures session with Bertrand Le Roy at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL14/"&gt;Take a look at distributed web caching with "Velocity" with Murali Krishnaprased at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Data&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL20/"&gt;See where Entity Framework is heading with Tim Mallalieu at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL08/"&gt;Check out how ADO.NET Data Services becomes online/offline with Pablo Castro at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Office&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL01/"&gt;Deploying Office Applications with Sauurabh Bhatia at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Other&lt;/li&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL33/"&gt;Have a look at the Managed Extensibility Framework with Glenn Block at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt; &lt;p&gt;&lt;br&gt;&lt;/p&gt; &lt;p&gt;If you want to look at what &lt;strong&gt;Visual Studio Team System 2010&lt;/strong&gt; is bringing then;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL47/"&gt;Watch Cameron Skinner take a Lap Around VSTS 2010 at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL52/"&gt;Walk through new VSTS 2010 features with Brian Harry at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL37/"&gt;Check out "Team Lab" with Ram Cherla at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL15/"&gt;Look at the new UML designers in VSTS Architecture Edition with Peter Provost at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL09/"&gt;Look at Agile development with VSTS 2010 with Sunder Raman at PDC&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL03/"&gt;Check out quality &amp;amp; diagnostics tooling with Habib Heydarian at PDC&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If you've got through that little lot already you're quite some way ahead of me.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10923" width="1" height="1"&gt;</description></item><item><title>Xbox 360: New Xbox Experience Today</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10910.aspx</link><pubDate>Wed, 19 Nov 2008 11:45:56 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10910</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10910.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10910</wfw:commentRss><description>&lt;p&gt;I'm not a big gamer. I hadn't turned my Xbox on for about 3 months before I recently bought &lt;strong&gt;Far Cry 2&lt;/strong&gt; which I'm playing through and really enjoying. I'm also thinking of &lt;strong&gt;Mirror's Edge&lt;/strong&gt; as I played a preview of that and it looks really cool.&lt;/p&gt; &lt;p&gt;However...today is the launch of the &lt;a href="http://www.xbox.com/en-GB/live/nxe/default.htm"&gt;New Xbox Experience&lt;/a&gt; which looks pretty cool and has one particular feature that sounds very attractive to me - &lt;strong&gt;the ability to install a DVD based game to the hard-drive.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I really want to try that out - with the best will in the world, the Xbox DVD drive ( like most DVD drives ) makes a lot of noise and so I'd expect that a game coming from the hard-drive would be a lot quicker and a lot quieter. Hopefully, I'll get to give the NXE a whirl later today :-)&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10910" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1028.aspx">Off Topic</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 7 (of 7 :-))</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10908.aspx</link><pubDate>Wed, 19 Nov 2008 11:42:00 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10908</guid><dc:creator>mtaulty</dc:creator><slash:comments>4</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10908.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10908</wfw:commentRss><description>&lt;p&gt;Following on from &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10906.aspx"&gt;the previous post&lt;/a&gt; I had one last thing that I wanted to do. &lt;/p&gt; &lt;p&gt;At the moment, when my application moves from one feed item to another, it simply hides the UI displaying the feed item and then shows it again at a later point which is a bit "dull". It'd be nice if it did some kind of transition.&lt;/p&gt; &lt;p&gt;I figured that I'd use the &lt;a href="http://www.codeplex.com/wpffx"&gt;Shader Effect Library from CodePlex&lt;/a&gt; for this so I downloaded it and then added a reference to the ShaderEffectLibrary from my project;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart7of7_6E1/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart7of7_6E1/image_thumb.png" width="244" height="190"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Now I can make use of an effect on my user control. Picking a ripple effect, I can make sure my XAML can "see" the library;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;xmlns:effects="clr-namespace:ShaderEffectLibrary;assembly=ShaderEffectLibrary"&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and then I can add an effect to my declaration of my user control in my main UI as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl&lt;/span&gt;
      &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="displayControl"&lt;/span&gt;
      &lt;span class="attr"&gt;Visibility&lt;/span&gt;&lt;span class="kwrd"&gt;="Hidden"&lt;/span&gt;
      &lt;span class="attr"&gt;ControlReady&lt;/span&gt;&lt;span class="kwrd"&gt;="OnItemDisplayReady"&lt;/span&gt; 
      &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Column&lt;/span&gt;&lt;span class="kwrd"&gt;="1"&lt;/span&gt;
      &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="1in"&lt;/span&gt;
      &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt;
      &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl.Effect&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;effects:RippleEffect&lt;/span&gt;
          &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="ripple"&lt;/span&gt;
          &lt;span class="attr"&gt;Amplitude&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;
          &lt;span class="attr"&gt;Phase&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;
          &lt;span class="attr"&gt;Frequency&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;
          &lt;span class="attr"&gt;Center&lt;/span&gt;&lt;span class="kwrd"&gt;="0.5,0.5"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl.Effect&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;now I can add some Storyboards to my main UI to manipulate that effect ( this XAML is a snippet rather than the whole UI definition );&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Storyboard&lt;/span&gt;
      &lt;span class="attr"&gt;x:Key&lt;/span&gt;&lt;span class="kwrd"&gt;="sbRipple"&lt;/span&gt;
      &lt;span class="attr"&gt;Storyboard&lt;/span&gt;.&lt;span class="attr"&gt;TargetName&lt;/span&gt;&lt;span class="kwrd"&gt;="displayControl"&lt;/span&gt;
      &lt;span class="attr"&gt;FillBehavior&lt;/span&gt;&lt;span class="kwrd"&gt;="Stop"&lt;/span&gt;
      &lt;span class="attr"&gt;Duration&lt;/span&gt;&lt;span class="kwrd"&gt;="00:00:00.5"&lt;/span&gt;
      &lt;span class="attr"&gt;AutoReverse&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DoubleAnimation&lt;/span&gt;
        &lt;span class="attr"&gt;From&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;
        &lt;span class="attr"&gt;To&lt;/span&gt;&lt;span class="kwrd"&gt;="0.5"&lt;/span&gt;
        &lt;span class="attr"&gt;Storyboard&lt;/span&gt;.&lt;span class="attr"&gt;TargetProperty&lt;/span&gt;&lt;span class="kwrd"&gt;="(Effect).(effects:RippleEffect.Amplitude)"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DoubleAnimation&lt;/span&gt;
        &lt;span class="attr"&gt;From&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;
        &lt;span class="attr"&gt;To&lt;/span&gt;&lt;span class="kwrd"&gt;="50"&lt;/span&gt;
        &lt;span class="attr"&gt;Storyboard&lt;/span&gt;.&lt;span class="attr"&gt;TargetProperty&lt;/span&gt;&lt;span class="kwrd"&gt;="(Effect).(effects:RippleEffect.Frequency)"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Storyboard&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and I need to rejig my code a little bit so that rather than just displaying the new item, we ripple it as well :-) Updated code is;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnItemDisplayReady(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)
    {
      ShowItemDisplayControl();
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; ShowItemDisplayControl()
    {
      displayControl.Visibility = Visibility.Visible;
      SbRipple.Begin();
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; HideItemDisplayControl()
    {
      displayControl.Visibility = Visibility.Hidden;      
    }
    Storyboard SbRipple
    {
      get
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; (mainGrid.FindResource(&lt;span class="str"&gt;"sbRipple"&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; Storyboard);
      }
    }&lt;/pre&gt;
&lt;p&gt;and that's it (for now) - I'm done with it. There are some other things I could do here;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fix a bug that I know is lurking in there where certain Feed Items don't display. Trying to nail that down. 
&lt;li&gt;Add some UI around only include Positive/Negative sentiment in the searches.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;but I've had fun playing with WPF and Blend and it's also strangely introduced me to the idea that watching Twitter feeds is very addictive and I already learnt a whole bunch of stuff this morning that I wouldn't otherwise know so I think I might have to become a bit of a Twitter-watcher (is that a &lt;strong&gt;Twitcher?&lt;/strong&gt;) if not a Tweeter.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/downloads/BlogPostTwistori_3.zip"&gt;The final bits for download are here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10908" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 6</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10906.aspx</link><pubDate>Wed, 19 Nov 2008 11:40:12 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10906</guid><dc:creator>mtaulty</dc:creator><slash:comments>2</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10906.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10906</wfw:commentRss><description>&lt;p&gt;Following on from &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10904.aspx"&gt;this previous post&lt;/a&gt; there's a few things wrong with where I've got to so far and some improvements that I'd like to make;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;I'd like to display something when there's no new feed items available.  &lt;li&gt;I'd like some kind of transition when one feed item moves to another.  &lt;li&gt;I'd like to avoid displaying an empty user control when the application starts up. That is, this doesn't look great;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart6_1044E/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart6_1044E/image_thumb.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;whilst I'm waiting for the first item to come in and, finally,&lt;/p&gt; &lt;ol&gt; &lt;li&gt;There's a problem with images. I'm loading an image over the web and I need to know when it's loaded otherwise the image goes on the screen before it's really loaded and then updates whilst the user is looking at it and that doesn't seem right at all to me :-)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;So, 4 things to fix even if the last one is called (1) just like the first one - I can't work list numbering in Live Writer :-)&lt;/p&gt; &lt;p&gt;Dealing with the first issue isn't too difficult - my &lt;strong&gt;AtomFeedManager&lt;/strong&gt; class fires a &lt;strong&gt;FeedItemUnavailable&lt;/strong&gt; event so I could just add code to the handler for that which manufactures a "fake" item to display when there's nothing else to display as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemUnavailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemUnavailableEventArgs args)
    {
      Dispatcher.BeginInvoke(&lt;span class="kwrd"&gt;new&lt;/span&gt; Action(() =&amp;gt;
      {
        displayControl.DataContext = &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedItem()
        {
          Author = &lt;span class="str"&gt;"none"&lt;/span&gt;,
          AuthorImageUri = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;"pack://application:,,,/question.jpg"&lt;/span&gt;),
          Title = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"No activity for {0:0} seconds, check your options"&lt;/span&gt;,
            args.UnavailableTime.TotalSeconds),
          PublishedDate = DateTime.Now
        };
      }));
    }&lt;/pre&gt;
&lt;p&gt;where I'm just making up a data item because none is available. The only "odd" thing about this is that I've added an existing image &lt;strong&gt;question.jpg&lt;/strong&gt; to the project and set it to be built as a &lt;strong&gt;resource&lt;/strong&gt; to embed it into the assembly and then I can then use the &lt;strong&gt;pack: &lt;/strong&gt;URI in order to make use of that image.&lt;/p&gt;
&lt;p&gt;This means that when there is no data I now see something like this;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart6_1044E/image_3.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart6_1044E/image_thumb_3.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;so that's one of my issue-list items sorted.&lt;/p&gt;
&lt;p&gt;Thinking about what to do about the initial blank display - it seems simple to initially mark the control as hidden and only display it when the first feed item arrives (even if it is a made-up feed item when there are no feed items available).&lt;/p&gt;
&lt;p&gt;That's fine...however I still have the problem with images. How to know when an image is &lt;strong&gt;really&lt;/strong&gt; ready for display because I don't want to put my &lt;strong&gt;ItemDisplayControl&lt;/strong&gt; onto the screen if it has still to load image for the author of the tweet from the web. I only want that thing to appear on the screen when the image is good and loaded.&lt;/p&gt;
&lt;p&gt;For me, this introduces the idea that my &lt;strong&gt;ItemDisplayControl&lt;/strong&gt; could fire some &lt;strong&gt;Ready&lt;/strong&gt; style event when a user of the control can feel confident that it's good to put the control onto the screen knowing that its image will have been loaded.&lt;/p&gt;
&lt;p&gt;How do we know when a WPF image has been loaded from the network? &lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Image&lt;/strong&gt; doesn't tell us this but the &lt;strong&gt;BitmapImage&lt;/strong&gt; class does. Inside of my user control, I'm using an Image like this;&lt;/p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt;
          &lt;span class="attr"&gt;Stretch&lt;/span&gt;&lt;span class="kwrd"&gt;="Fill"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxWidth&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxHeight&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="2,2,2,2"&lt;/span&gt;
          &lt;span class="attr"&gt;Source&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding AuthorImageUri}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;so I'd assume that I can do something like;&lt;/p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt;
          &lt;span class="attr"&gt;Stretch&lt;/span&gt;&lt;span class="kwrd"&gt;="Fill"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxWidth&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxHeight&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="2,2,2,2"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Image.Source&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;BitmapImage&lt;/span&gt;
              &lt;span class="attr"&gt;UriSource&lt;/span&gt;&lt;span class="kwrd"&gt;="Source={Binding AuthorImageUri}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Image.Source&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and then I could add handlers to the events like &lt;strong&gt;DownloadCompleted&lt;/strong&gt; and &lt;strong&gt;DownloadFailed&lt;/strong&gt; on that &lt;strong&gt;BitmapImage&lt;/strong&gt; which is what I need.&lt;/p&gt;
&lt;p&gt;However...I don't think that I can directly bind that &lt;strong&gt;UriSource&lt;/strong&gt; property like that ( see &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/85cffb5c-05a4-4653-a263-183f20ddd2c2/"&gt;here&lt;/a&gt; ). Now, however I tried to do this with converters and so on I never quite managed to get this to work and so I resorted to code. I thought I'd handle the &lt;strong&gt;DataContextChanged&lt;/strong&gt; event myself on the &lt;strong&gt;Image &lt;/strong&gt;as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt;
          &lt;span class="attr"&gt;DataContextChanged&lt;/span&gt;&lt;span class="kwrd"&gt;="OnDataContextChanged"&lt;/span&gt;
          &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="imageAuthor"&lt;/span&gt;
          &lt;span class="attr"&gt;Stretch&lt;/span&gt;&lt;span class="kwrd"&gt;="Fill"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxWidth&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;MaxHeight&lt;/span&gt;&lt;span class="kwrd"&gt;="96"&lt;/span&gt;
          &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;="Auto"&lt;/span&gt;
          &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="2,2,2,2"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and then I can put some code behind that leaving my code for my &lt;strong&gt;ItemDisplayControl&lt;/strong&gt; looking like;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ItemDisplayControl : UserControl
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; EventHandler ControlReady;

    &lt;span class="kwrd"&gt;public&lt;/span&gt; ItemDisplayControl()
    {
      InitializeComponent();
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; FireControlReady()
    {
      &lt;span class="kwrd"&gt;if&lt;/span&gt; (ControlReady != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
      {
        ControlReady(&lt;span class="kwrd"&gt;this&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);
      }
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnImageDataContextChanged(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, DependencyPropertyChangedEventArgs e)
    {
      AtomFeedItem feedItem = (AtomFeedItem)e.NewValue;

      &lt;span class="rem"&gt;// The item may not have an image, in which case...we are done.&lt;/span&gt;
      &lt;span class="kwrd"&gt;if&lt;/span&gt; (!feedItem.HasImage)
      {
        FireControlReady();
      }
      &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (!feedItem.HasImageNeedingDownload)
      {
        &lt;span class="rem"&gt;// Some images are packed (i.e. pack://) into the executable. No&lt;/span&gt;
        &lt;span class="rem"&gt;// need to download them.&lt;/span&gt;
        imageAuthor.Source = &lt;span class="kwrd"&gt;new&lt;/span&gt; BitmapImage(feedItem.AuthorImageUri);
        FireControlReady();
      }
      &lt;span class="kwrd"&gt;else&lt;/span&gt;
      {
        BitmapImage bi = &lt;span class="kwrd"&gt;new&lt;/span&gt; BitmapImage();
        bi.BeginInit();
        bi.UriSource = feedItem.AuthorImageUri;
        bi.DownloadCompleted += (s, args) =&amp;gt;
          {
            imageAuthor.Source = bi;
            FireControlReady();
          };
        bi.DownloadFailed += (s, args) =&amp;gt;
          {
            FireControlReady();
          };
        bi.EndInit();
      }
    }
  }
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The use of this control in the main Window then changes. Initially, I want it to be invisible and I want to handle its &lt;strong&gt;ControlReady&lt;/strong&gt; event. Here's the updated snippet of XAML from the main UI which declares the control;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl&lt;/span&gt;
      &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="displayControl"&lt;/span&gt;
      &lt;span class="attr"&gt;Visibility&lt;/span&gt;&lt;span class="kwrd"&gt;="Hidden"&lt;/span&gt;
      &lt;span class="attr"&gt;ControlReady&lt;/span&gt;&lt;span class="kwrd"&gt;="OnItemDisplayReady"&lt;/span&gt; 
      &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Column&lt;/span&gt;&lt;span class="kwrd"&gt;="1"&lt;/span&gt;
      &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt;
      &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;and then I can handle that &lt;strong&gt;ControlReady&lt;/strong&gt; event in my &lt;strong&gt;OnItemDisplayReady&lt;/strong&gt; handler by just changing the visibility;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnItemDisplayReady(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)
    {
      ShowItemDisplayControl();
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; ShowItemDisplayControl()
    {
      displayControl.Visibility = Visible;
    }&lt;/pre&gt;
&lt;p&gt;and I can make sure that I hide the control whenever we change its data context thereby forcing it to load a new image which is in the handlers for items becoming available/unavailable;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemAvailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemAvailableEventArgs args)
    {
      Dispatcher.BeginInvoke(&lt;span class="kwrd"&gt;new&lt;/span&gt; Action(() =&amp;gt;
        {
          HideItemDisplayControl();
          displayControl.DataContext = args.FeedItem;
          listSearchTerms.SelectedItem = args.SearchTerm;
          listSearchTerms.ScrollIntoView(args.SearchTerm);
        }));
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemUnavailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemUnavailableEventArgs args)
    {
      Dispatcher.BeginInvoke(&lt;span class="kwrd"&gt;new&lt;/span&gt; Action(() =&amp;gt;
      {
        HideItemDisplayControl();
        displayControl.DataContext = &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedItem()
        {
          Author = &lt;span class="str"&gt;"none"&lt;/span&gt;,
          AuthorImageUri = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;"pack://application:,,,/question.jpg"&lt;/span&gt;),
          Title = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"No activity for {0:0} seconds, check your options"&lt;/span&gt;,
            args.UnavailableTime.TotalSeconds),
          PublishedDate = DateTime.Now
        };
      }));
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; HideItemDisplayControl()
    {
      displayControl.Visibility = Visibility.Hidden;
    }&lt;/pre&gt;
&lt;p&gt;and that all works quite nicely.&lt;/p&gt;
&lt;p&gt;So, I've solved items (1), (3) and (4) of my original list - all I'd like now is some kind of transition between one item leaving and the next one arriving. I'll leave that to the next post. &lt;/p&gt;
&lt;p&gt;In the meantime, &lt;a href="http://mtaulty.com/downloads/BlogPostTwistori_2.zip"&gt;the bits as they currently stand are here for download&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10906" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 5</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10904.aspx</link><pubDate>Wed, 19 Nov 2008 11:35:46 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10904</guid><dc:creator>mtaulty</dc:creator><slash:comments>2</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10904.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10904</wfw:commentRss><description>&lt;p&gt;Following on from &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10902.aspx"&gt;the previous post&lt;/a&gt; I wanted to take the UI that I have so far;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and attempt to style that ListBox over on the right hand side. The first thing I'd do with it is to remove its background;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_3.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_3.png" width="242" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;which stops it being a big white area of the screen. Then I altered its border to use a linear gradient brush.&lt;/p&gt; &lt;p&gt;With that in place, I want to change the template for the CheckBox that is being displayed by the ListBox so I need to go and edit the ItemTemplate for the ListBox which I created in a previous post by just putting a Grid and a CheckBox in it;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_4.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_4.png" width="244" height="171"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and so the item template just looks like this;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_5.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_5.png" width="244" height="147"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and what I can then do is to edit the template of that CheckBox to replace it with my own "design" as in;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_6.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_6.png" width="177" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;The template for the CheckBox looks like this;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_7.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_7.png" width="244" height="150"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and it has some triggers in that you can see certain actions being taken when the element &lt;strong&gt;HasContent&lt;/strong&gt; or &lt;strong&gt;IsEnabled - &lt;/strong&gt;these are probably not so relevant for me and will almost certainly disappear in my template but they are as below;&lt;/p&gt; &lt;p&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_8.png" width="206" height="244"&gt;&lt;/p&gt; &lt;p&gt;I want a template that's more based around a circular "tickbox" so I go ahead and define some UI for that as below;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_9.png" width="644" height="380"&gt; &lt;/p&gt; &lt;p&gt;and that's just a simple ellipse with a path drawn through it as a Tick mark and another one as a Cross mark and then there's a content presenter below it. I want to control the visibility of the marks depending on whether the CheckBox is checked or not and so I can set them both to be &lt;strong&gt;Visibility=Hidden&lt;/strong&gt; and then control the visibility from a trigger as in;&lt;/p&gt; &lt;p&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_10.png" width="240" height="484"&gt; &lt;/p&gt; &lt;p&gt;Now, I've drawn my UI here at a fixed scale and so I tend to wrap a &lt;strong&gt;Viewbox&lt;/strong&gt; around it just to get it to scale up a little and then made sure that Viewbox is doing uniform scaling (its &lt;strong&gt;Stretch&lt;/strong&gt; property).&lt;/p&gt; &lt;p&gt;With that in place I want to tweak a few more properties. Firstly, I want to make sure that my &lt;strong&gt;ListBox&lt;/strong&gt; has its &lt;strong&gt;HorizontalScrollBarVisibility&lt;/strong&gt; set to &lt;strong&gt;Disabled&lt;/strong&gt; (I don't want horizontal scrolling here) and its &lt;strong&gt;VerticalScrollBarVisibility&lt;/strong&gt; set to &lt;strong&gt;Hidden&lt;/strong&gt; (I might want the list to scroll vertically but I don't want the scrollbar visible). I also set a margin around the &lt;strong&gt;Grid&lt;/strong&gt; in the ListBox ItemTemplate so that it spaced itself out a little and finally I want to set the &lt;strong&gt;Foreground&lt;/strong&gt; for the &lt;strong&gt;CheckBox &lt;/strong&gt;to white.&lt;/p&gt; &lt;p&gt;With all that in place, running my app now gives me;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_11.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_8.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;It's moving along a little bit. However, I'd like to make sure that whenever a feed item comes in I highlight search the relevant search term over in the ListBox on the left hand side. From a coding perspective this is easy as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemAvailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemAvailableEventArgs args)
    {
      Dispatcher.BeginInvoke(&lt;span class="kwrd"&gt;new&lt;/span&gt; Action(() =&amp;gt;
        {
          displayControl.DataContext = args.FeedItem;
          listSearchTerms.SelectedItem = args.SearchTerm;
          listSearchTerms.ScrollIntoView(args.SearchTerm);
        }));
    }&lt;/pre&gt;
&lt;p&gt;to highlight the right item in the ListBox. However, it raises this bit of ugliness;&lt;/p&gt;
&lt;p&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_12.png" width="244" height="154"&gt; &lt;/p&gt;
&lt;p&gt;in that the listbox selected item now has this funny white rectangle around it. I don't want that so how to get rid of it? This selection rectangle is actually placed over the top of this thing by the Item Container and so we need to go and find the style for that thing by editing the Item Container Style;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_13.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_9.png" width="222" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and then within there editing the template;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_14.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_10.png" width="182" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;which shows that we have a border (and some triggers) wrapped around our ListBox item;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_15.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_11.png" width="132" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I don't want that behaviour so I deleted the various triggers and then just added a single new one for the &lt;strong&gt;IsSelected&lt;/strong&gt; event which would give the Border a little BorderBrush and a little Background as in;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_16.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_12.png" width="208" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and so that means that my UI now looks like this as/when a feed item comes in ( the green background isn't "so great" but I get away with it );&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_17.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_13.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;so that's better than the white rectangle anyway. I also figure that it might be nice if these items did a little animation and grew/shrank as and when they were made the selected item so I threw in a scale transform on the border;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_18.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_14.png" width="244" height="80"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;added an animation to make the item grow with some easing...&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_19.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_15.png" width="244" height="101"&gt;&lt;/a&gt; &lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_20.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_16.png" width="244" height="238"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and then threw in another one called "shrink" which did the reverse and used these as part of my triggers;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_21.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart5_F655/image_thumb_17.png" width="182" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and I'm reasonably happy with my ListBox at that point. &lt;/p&gt;
&lt;p&gt;There are still a number of "issues" though that I'd like to take a look at - that'll be in the follow on post. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/downloads/WpfTwistori_1.zip"&gt;For now, I've put the project here for download in the state that tries to match up with this blog post&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10904" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 4</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10902.aspx</link><pubDate>Wed, 19 Nov 2008 11:26:45 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10902</guid><dc:creator>mtaulty</dc:creator><slash:comments>2</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10902.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10902</wfw:commentRss><description>&lt;p&gt;Following up on &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10900.aspx"&gt;this post&lt;/a&gt; it's time to make the thing look a little bit better than it does right now. Some of this will be purely cosmetic, some of it will end up requiring some code changes.&lt;/p&gt; &lt;p&gt;In the first instance, I'll go for some "cheap wins". I'll open up Expression Blend with my project and, first off, I'll go and grab a Windows-themed wallpaper from &lt;a href="http://www.hdwallpapers.net"&gt;www.hdwallpapers.net&lt;/a&gt; (in the Computer section) such as this one;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.hdwallpapers.net/gallery/wallpapers/computer/computer_0036.zip"&gt;&lt;img border="0" alt="Wallpaper pack by Tinkupuri" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/computer_0036.jpg" width="244" height="184"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;then I go to my project in Blend and add an existing item;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb.png" width="244" height="232"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and add that Image into the project. Having done that, what I usually do is right mouse on it to insert it into the scene;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_3.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_3.png" width="240" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;with the image in the scene, I make sure it's selected and then I used Tools-&amp;gt;Make Brush Resource to create myself a new ImageBrush;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_4.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_4.png" width="244" height="143"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;With that created, I go and delete the image from the scene (not from the project!) and then I can go to the Window and set its background to be the Image Brush I just created as in;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_5.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_5.png" width="244" height="106"&gt;&lt;/a&gt; &lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_6.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_6.png" width="244" height="190"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and so now I've got a nice(r) background.&lt;/p&gt; &lt;p&gt;From there, it'd be nice to style my &lt;strong&gt;ItemDisplayControl&lt;/strong&gt; UserControl that I built in the last post. Opening up that XAML file in the project...&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;Aside - there's a bunch of useful short-cuts in Expression Blend. I recommend reading the help file but, generally, I find that &lt;strong&gt;CTRL++ &lt;/strong&gt;and &lt;strong&gt;CTRL+-&lt;/strong&gt; are useful for zooming in and out. Selecting something in the "Objects/Timeline" tree and then hitting &lt;strong&gt;CTRL+0&lt;/strong&gt; is great for zooming in to one particular element (especially for templates) and then F6 is useful for changing the views and TAB/F4 are useful for getting UI out of your way.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;gives me something that looks like this;&lt;/p&gt; &lt;p&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_7.png" width="644" height="462"&gt; &lt;/p&gt; &lt;p&gt;and so our UserControl is just a Grid with a StackPanel that has an Image, TextBlock and then there's another TextBlock.&lt;/p&gt; &lt;p&gt;In the first instance, I want to add some kind of "header" behind that StackPanel which I'll do just by adding a Rectangle to the same Grid cell but I want it behind the StackPanel in the z-order as in;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_8.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_7.png" width="244" height="172"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and then I can give that rectangle a bit of colour by changing its background, its stroke, its RadiusX, RadiusY, its Margin all in the properties panel. One of the things to say here is that when making colours for Backgrounds, Strokes etc. it's useful to make them as resources in Blend;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_9.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_8.png" width="182" height="244"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;so that you can then re-use them rather than trying to re-create them. Having given my rectangle a bit of a fill;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_10.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_9.png" width="244" height="42"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;I also want to wrap a little Border around my Image and give it both a bit of a margin and a bit of a drop shadow. That is;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_11.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_10.png" width="244" height="153"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Then I can style that border by giving it a stroke ( I re-used the one from my rectangle above ), I can give it a little Margin ( say 10 pixels ) and then I can add an effect to it making it a DropShadowEffect and setting properties as below;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_12.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_11.png" width="244" height="138"&gt;&lt;/a&gt; &lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_13.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_12.png" width="244" height="213"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;I'd also like to style my fonts so I can take the TextBlock which is representing the &lt;strong&gt;Author&lt;/strong&gt; and is a child of the &lt;strong&gt;StackPanel&lt;/strong&gt; and change its font family to &lt;strong&gt;Gungsuh, &lt;/strong&gt;the size to &lt;strong&gt;36&lt;/strong&gt;, the vertical alignment to &lt;strong&gt;Center, &lt;/strong&gt;the foreground to a near-white colour. &lt;/p&gt; &lt;p&gt;For my other TextBlock which displays the contents of the Tweet, I change the font family to &lt;strong&gt;Segoe Print, &lt;/strong&gt;the foreground colour to a near-black and the font-size to 48.&lt;/p&gt; &lt;p&gt;Running my app, the UI currently looks like;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_14.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_13.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;It's looking a bit better (highly subjective! :-)) but the background is merging with the text so I think it's time to give that grid on my user control a background of its very own and maybe to apply a little drop-shadow to it as well repeating what I did earlier. &lt;/p&gt; &lt;p&gt;With that in place, the UI now looks like;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_15.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart4_E849/image_thumb_14.png" width="244" height="154"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Not too bad although it has a bunch of "problems" that I'll come back to later. &lt;/p&gt; &lt;p&gt;Enough of trying to "style" this &lt;strong&gt;ItemDisplayControl&lt;/strong&gt;, I'll move on to trying to style the ListBox and the items that it contains in the next post.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10902" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 3</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10900.aspx</link><pubDate>Wed, 19 Nov 2008 11:19:58 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10900</guid><dc:creator>mtaulty</dc:creator><slash:comments>2</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10900.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10900</wfw:commentRss><description>&lt;p&gt;Following on &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10897.aspx"&gt;from my previous post&lt;/a&gt;, I wanted to create a WPF UI around what I'd done so far.&lt;/p&gt; &lt;p&gt;I'll step through this one a little bit. Making a new project;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_thumb.png" width="244" height="163"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;adding a reference to my library for using twitter feeds;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_3.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_thumb_3.png" width="244" height="190"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;now I want my WPF Window to maximise itself on the screen and to be the topmost window so I'd play with settings to achieve that and change the Window title whilst I'm there (even if it's not displayed).&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt; &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="BlogPostTwistori.Window1"&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
    &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;="Mike's Twistori-Like App"&lt;/span&gt;
    &lt;span class="attr"&gt;Topmost&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;
    &lt;span class="attr"&gt;WindowState&lt;/span&gt;&lt;span class="kwrd"&gt;="Maximized"&lt;/span&gt;
    &lt;span class="attr"&gt;WindowStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="None"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Now maximised windows can be a pain to debug so I'd probably switch off &lt;strong&gt;Topmost&lt;/strong&gt; whilst I'm working on the code and also it'd be nice to have a way to get rid of the application by pressing the ESCape key. If WPF defined an &lt;strong&gt;ApplicationCommands.Exit&lt;/strong&gt; command then I think you'd be able to do this without writing any code but I don't think it has such a command. So...we can create one;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CustomCommands
  {
    &lt;span class="kwrd"&gt;static&lt;/span&gt; CustomCommands()
    {
      exitCommand = &lt;span class="kwrd"&gt;new&lt;/span&gt; RoutedCommand(&lt;span class="str"&gt;"Exit"&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CustomCommands));
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; RoutedCommand Exit
    {
      get
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; (exitCommand);
      }
    }
    &lt;span class="kwrd"&gt;static&lt;/span&gt; RoutedCommand exitCommand;
  }&lt;/pre&gt;
&lt;p&gt;and then we can add a binding for it to our Window (notice that we're bringing the local code namespace into the XAML here, I tend to use the prefix &lt;strong&gt;local&lt;/strong&gt; for that);&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;
  &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="BlogPostTwistori.Window1"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
  &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;="Mike's Twistori-Like App"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;="clr-namespace:BlogPostTwistori"&lt;/span&gt;
  &lt;span class="attr"&gt;Topmost&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowState&lt;/span&gt;&lt;span class="kwrd"&gt;="Maximized"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="None"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;KeyBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Key&lt;/span&gt;&lt;span class="kwrd"&gt;="ESC"&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;CommandBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt;
      &lt;span class="attr"&gt;Executed&lt;/span&gt;&lt;span class="kwrd"&gt;="OnExit"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;and then we can add a handler for it;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Window1 : Window
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; Window1()
    {
      InitializeComponent();
    }
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnExit(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, ExecutedRoutedEventArgs e)
    {
      Application.Current.Shutdown();
    }
  }&lt;/pre&gt;
&lt;p&gt;and so now we have a Window which can be closed by pressing the ESCape key (alongside the usual ALT+F4 and so on).&lt;/p&gt;
&lt;p&gt;Ok, so setting up our main window so that it gets some data from the Twitter feeds;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Window1 : Window
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; Window1()
    {
      InitializeComponent();

      &lt;span class="kwrd"&gt;this&lt;/span&gt;.Loaded += OnLoaded;
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnLoaded(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
    {
      &lt;span class="rem"&gt;// TODO: Handle exceptions from config loading?&lt;/span&gt;
      SearchTermsConfiguration config = SearchTermsConfiguration.LoadFromConfig();

      feedManager = &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedManager(config, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 5));

      feedManager.FeedItemAvailable += OnFeedItemAvailable;
      feedManager.FeedItemUnavailable += OnFeedItemUnavailable;
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemAvailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemAvailableEventArgs args)
    {
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemUnavailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemUnavailableEventArgs args)
    {
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnExit(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, ExecutedRoutedEventArgs e)
    {
      Application.Current.Shutdown();
    }
    AtomFeedManager feedManager;
  }&lt;/pre&gt;
&lt;p&gt;It would now be handy to have somewhere to display my list of search terms. Adding a ListBox and some grid columns to the UI;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;
  &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="BlogPostTwistori.Window1"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
  &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;="Mike's Twistori-Like App"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;="clr-namespace:BlogPostTwistori"&lt;/span&gt;
  &lt;span class="attr"&gt;Topmost&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowState&lt;/span&gt;&lt;span class="kwrd"&gt;="Maximized"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="None"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;KeyBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Key&lt;/span&gt;&lt;span class="kwrd"&gt;="ESC"&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;CommandBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt;
      &lt;span class="attr"&gt;Executed&lt;/span&gt;&lt;span class="kwrd"&gt;="OnExit"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;
    &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="mainGrid"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt;
        &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="0.2*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ListBox&lt;/span&gt;
      &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="10"&lt;/span&gt;
      &lt;span class="attr"&gt;ItemsSource&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding}"&lt;/span&gt;
      &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="listSearchTerms"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DataTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;CheckBox&lt;/span&gt;
              &lt;span class="attr"&gt;IsChecked&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding IsIncluded}"&lt;/span&gt;
              &lt;span class="attr"&gt;Content&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding Term}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;DataTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ListBox&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and I need to make sure that my &lt;strong&gt;OnLoaded&lt;/strong&gt; function (or something) sets up the &lt;strong&gt;DataContext&lt;/strong&gt; for that &lt;strong&gt;ListBox&lt;/strong&gt; that's called &lt;strong&gt;listSearchTerms&lt;/strong&gt; as in this last line of code here;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnLoaded(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
    {
      &lt;span class="rem"&gt;// TODO: Handle exceptions from config loading?&lt;/span&gt;
      SearchTermsConfiguration config = SearchTermsConfiguration.LoadFromConfig();

      feedManager = &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedManager(config, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 5));

      feedManager.FeedItemAvailable += OnFeedItemAvailable;
      feedManager.FeedItemUnavailable += OnFeedItemUnavailable;

      listSearchTerms.DataContext = config;
    }&lt;/pre&gt;
&lt;p&gt;Ok...so I have something that runs and displays UI;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_4.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_thumb_4.png" width="244" height="135"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and that UI is bound to the right properties underneath so that should all work nicely. When a feed item arrives, I need something to display it in so let's add a quick user control;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_5.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_thumb_5.png" width="644" height="363"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and let's throw a little bit of UI in there as well;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;UserControl
  x:Class=&lt;span class="str"&gt;"BlogPostTwistori.ItemDisplayControl"&lt;/span&gt;
  xmlns=&lt;span class="str"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
  xmlns:x=&lt;span class="str"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&amp;gt;
  &amp;lt;Grid&amp;gt;
    &amp;lt;Grid.RowDefinitions&amp;gt;
      &amp;lt;RowDefinition
        Height=&lt;span class="str"&gt;"Auto"&lt;/span&gt; /&amp;gt;
      &amp;lt;RowDefinition /&amp;gt;
    &amp;lt;/Grid.RowDefinitions&amp;gt;
    &amp;lt;StackPanel
      Orientation=&lt;span class="str"&gt;"Horizontal"&lt;/span&gt;&amp;gt;
      &amp;lt;Image
        Stretch=&lt;span class="str"&gt;"Fill"&lt;/span&gt;
        MaxWidth=&lt;span class="str"&gt;"96"&lt;/span&gt;
        MaxHeight=&lt;span class="str"&gt;"96"&lt;/span&gt;
        Source=&lt;span class="str"&gt;"{Binding AuthorImageUri}"&lt;/span&gt; /&amp;gt;
      &amp;lt;TextBlock
        Text=&lt;span class="str"&gt;"{Binding Author}"&lt;/span&gt; /&amp;gt;
    &amp;lt;/StackPanel&amp;gt;
    &amp;lt;TextBlock
      Grid.Row=&lt;span class="str"&gt;"1"&lt;/span&gt;
      TextWrapping=&lt;span class="str"&gt;"Wrap"&lt;/span&gt;
      Text=&lt;span class="str"&gt;"{Binding Title}"&lt;/span&gt; /&amp;gt;
  &amp;lt;/Grid&amp;gt;
&amp;lt;/UserControl&amp;gt;
&lt;/pre&gt;
&lt;p&gt;And I'll define one of these controls on my main UI as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;
  &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="BlogPostTwistori.Window1"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
  &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;="Mike's Twistori-Like App"&lt;/span&gt;
  &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;="clr-namespace:BlogPostTwistori"&lt;/span&gt;
  &lt;span class="attr"&gt;Topmost&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowState&lt;/span&gt;&lt;span class="kwrd"&gt;="Maximized"&lt;/span&gt;
  &lt;span class="attr"&gt;WindowStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="None"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;KeyBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Key&lt;/span&gt;&lt;span class="kwrd"&gt;="ESC"&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.InputBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;CommandBinding&lt;/span&gt;
      &lt;span class="attr"&gt;Command&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static local:CustomCommands.Exit}"&lt;/span&gt;
      &lt;span class="attr"&gt;Executed&lt;/span&gt;&lt;span class="kwrd"&gt;="OnExit"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.CommandBindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;
    &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="mainGrid"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt;
        &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="0.2*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ListBox&lt;/span&gt;
      &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="10"&lt;/span&gt;
      &lt;span class="attr"&gt;ItemsSource&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding}"&lt;/span&gt;
      &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="listSearchTerms"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DataTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;CheckBox&lt;/span&gt;
              &lt;span class="attr"&gt;IsChecked&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding IsIncluded}"&lt;/span&gt;
              &lt;span class="attr"&gt;Content&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding Term}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;DataTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ListBox&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:ItemDisplayControl&lt;/span&gt;
      &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="displayControl"&lt;/span&gt;
      &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Column&lt;/span&gt;&lt;span class="kwrd"&gt;="1"&lt;/span&gt;
      &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt;
      &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;="Center"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and then I just need to make sure that when a FeedItem arrives I set it as the DataContext for this user control as in;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnFeedItemAvailable(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, AtomFeedItemAvailableEventArgs args)
    {
      Dispatcher.BeginInvoke(&lt;span class="kwrd"&gt;new&lt;/span&gt; Action(() =&amp;gt;
        {
          displayControl.DataContext = args.FeedItem;
        }));
    }
&lt;/pre&gt;
&lt;p&gt;Note the switch to the dispatcher thread for this.&lt;/p&gt;
&lt;p&gt;Ok...with that in place, I have a working application - ok, it looks like a complete bag of spanners but it's working;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_6.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart3_E602/image_thumb_6.png" width="644" height="404"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Anyway...in the next post it'd be time to pop open Expression Blend and see if we can't make this look ever so slightly better.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10900" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 2</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10897.aspx</link><pubDate>Wed, 19 Nov 2008 11:14:26 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10897</guid><dc:creator>mtaulty</dc:creator><slash:comments>2</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10897.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10897</wfw:commentRss><description>&lt;p&gt;Following on &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10896.aspx"&gt;from the previous post&lt;/a&gt;, to get this work started I wanted to build a little library that supported what I wanted to do with the Twitter API.&lt;/p&gt; &lt;p&gt;There's probably already a .NET library out there but I didn't search for it and my needs were fairly small and specific.&lt;/p&gt; &lt;p&gt;The first thing that I wanted to do was to build a custom configuration file section to represent my configuration. In my configuration I wanted to be able to set;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;The language to use for searching twitter  &lt;li&gt;The set of search terms to search for. I wanted each search term to have the configuration options of;  &lt;ol&gt; &lt;li&gt;On/Off - i.e. &lt;strong&gt;isIncluded&lt;/strong&gt; when we do searching  &lt;li&gt;Filter - i.e. I wanted to be able to filter to only include "positive" tweets, "negative" tweets, tweets that are explicitly either "positive" or "negative" and then "all" tweets.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;I don't know what you do when you want a custom configuration file section but I know what I do. I use the &lt;a href="http://www.codeplex.com/csd"&gt;Configuration File Section Designer&lt;/a&gt; which I wrote about &lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/02/20/10191.aspx"&gt;here&lt;/a&gt;. If you don't use this designer then I guess that either;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;You don't build custom configuration file sections in .NET. Fair enough.  &lt;li&gt;You have a lot of spare time on your hands and don't like progress :-)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Seriously, it's brilliant and it's also a good example of what &lt;a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx"&gt;T4 templates&lt;/a&gt; can do for you.&lt;/p&gt; &lt;p&gt;And so...here's my "design" of my configuration file section or my &lt;strong&gt;.csd&lt;/strong&gt; file;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_thumb.png" width="415" height="484"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;what you can't see on the diagram is all the properties that are set on these items such as the code Namespace being &lt;strong&gt;SearchTermsConfig&lt;/strong&gt; or that &lt;strong&gt;language&lt;/strong&gt; is of type &lt;strong&gt;string&lt;/strong&gt; and is &lt;strong&gt;required&lt;/strong&gt; and so on and so forth.&lt;/p&gt; &lt;p&gt;What this ultimately gives me is a set of generated classes and, specifically, I can just write code like this;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
    {
      SearchTermsConfiguration config = SearchTermsConfiguration.Instance;

      Console.WriteLine(&lt;span class="str"&gt;"language is {0}"&lt;/span&gt;, config.language);

      &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SearchTerm term &lt;span class="kwrd"&gt;in&lt;/span&gt; config.SearchTerms)
      {
        Console.WriteLine(&lt;span class="str"&gt;"Term is {0}"&lt;/span&gt;, term.Term);
        Console.WriteLine(&lt;span class="str"&gt;"IsIncluded is {0}"&lt;/span&gt;, term.IsIncluded);
        Console.WriteLine(&lt;span class="str"&gt;"Filter is {0}"&lt;/span&gt;, term.Filter);
      }
    }&lt;/pre&gt;
&lt;p&gt;against a config file like this;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;section&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="searchTermsConfiguration"&lt;/span&gt;
             &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="SearchTermsConfig.SearchTermsConfiguration,ConsoleApplication3"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="rem"&gt;&amp;lt;!-- Set language to "en", "fr", etc. --&amp;gt;&lt;/span&gt;

  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTermsConfiguration&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="en"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="rem"&gt;&amp;lt;!-- isIncluded is a bool (true/false) which can be changed in the UI anyway --&amp;gt;&lt;/span&gt;
      &lt;span class="rem"&gt;&amp;lt;!-- filter is an enum which can be;&lt;/span&gt;
&lt;span class="rem"&gt;            Positive&lt;/span&gt;
&lt;span class="rem"&gt;            Negative&lt;/span&gt;
&lt;span class="rem"&gt;            PositiveAndNegative (not the same as "All" below)&lt;/span&gt;
&lt;span class="rem"&gt;            All&lt;/span&gt;
&lt;span class="rem"&gt;      --&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerm&lt;/span&gt; &lt;span class="attr"&gt;term&lt;/span&gt;&lt;span class="kwrd"&gt;="Microsoft"&lt;/span&gt;
                  &lt;span class="attr"&gt;isIncluded&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;
                  &lt;span class="attr"&gt;filter&lt;/span&gt;&lt;span class="kwrd"&gt;="All"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerm&lt;/span&gt; &lt;span class="attr"&gt;term&lt;/span&gt;&lt;span class="kwrd"&gt;="Windows"&lt;/span&gt;
                  &lt;span class="attr"&gt;isIncluded&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;
                  &lt;span class="attr"&gt;filter&lt;/span&gt;&lt;span class="kwrd"&gt;="All"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;searchTerms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;searchTermsConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;and it &lt;strong&gt;just works :-)&lt;/strong&gt; which is very cool. Ok, enough about the configuration section designer.&lt;/p&gt;
&lt;p&gt;I didn't want to just use these classes inside the rest of my code so I wrote some companion classes such as this little enum to represent my simplistic filtering;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  [Flags]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;enum&lt;/span&gt; SearchTermFilter
  {
    &lt;span class="rem"&gt;// Bit of a weird bitmask here. 0 means everything. Bits 1 and 2 filter it down.&lt;/span&gt;
    All                 = 0x0,
    Positive            = 0x1,
    Negative            = 0x2,
    PositiveAndNegative = 0x3,  &lt;span class="rem"&gt;// Only here so it can go in the config file.&lt;/span&gt;
  }&lt;/pre&gt;
&lt;p&gt;and this &lt;strong&gt;SearchTerm&lt;/strong&gt; class which in many ways mimics what I have in the configuration file but adds some more things that'll be useful to me at a later point;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_3.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_thumb_3.png" width="191" height="244"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;It's basically a class that can return the &lt;strong&gt;Term, &lt;/strong&gt;whether it's currently valid (&lt;strong&gt;IsTermValid)&lt;/strong&gt;, whether it's currently in-use (&lt;strong&gt;IsTermIncluded)&lt;/strong&gt;, what the filter is (&lt;strong&gt;Filter, FilterIncludesNegative, FilterIncludesPositive&lt;/strong&gt;) and the Uri that you need to use to hit Twitter to get an Atom feed for one of these things (&lt;strong&gt;AtomFeedUri&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;I also wrote a little collection class which keeps hold of these &lt;strong&gt;SearchTerms&lt;/strong&gt; for me and to load them from the configuration file (using the generated classes from the configuration section designer);&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SearchTermsConfiguration : ObservableCollection&amp;lt;SearchTerm&amp;gt;
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; SearchTermsConfiguration LoadFromConfig()
    {
      SearchTermsConfiguration collection = &lt;span class="kwrd"&gt;new&lt;/span&gt; SearchTermsConfiguration();

      &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SearchTermsConfig.SearchTerm configItem &lt;span class="kwrd"&gt;in&lt;/span&gt;
        SearchTermsConfig.SearchTermsConfiguration.Instance.SearchTerms)
      {
        collection.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; SearchTerm()
        {
          Term = configItem.Term,
          IsIncluded = configItem.IsIncluded,
          Filter = 
            (SearchTermFilter)Enum.Parse(
              &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(SearchTermFilter), configItem.Filter)
        });
      }
      &lt;span class="kwrd"&gt;return&lt;/span&gt; (collection);
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Language
    {
      get
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; (SearchTermsConfig.SearchTermsConfiguration.Instance.language);
      }
    }
  }&lt;/pre&gt;
&lt;p&gt;and you can see in there that I "hide" the underlying generated classes such as &lt;strong&gt;SearchTermsConfig.SearchTerm&lt;/strong&gt; in order to produce an &lt;strong&gt;ObservableCollection&lt;/strong&gt; of my own &lt;strong&gt;SearchTerm&lt;/strong&gt; class. You might also spot the string from the configuration file being turned into an instance of my &lt;strong&gt;SearchTermFilter&lt;/strong&gt; enumeration.&lt;/p&gt;
&lt;p&gt;With that in place, I need something that reads one of these Twitter feeds that correspond to a particular search term and so I wrote a little class called &lt;strong&gt;AtomFeedReader&lt;/strong&gt; (bad name because it's more specific than the name implies). I won't include the whole source for it here but it looks like this and brings in another class with a bad name, &lt;strong&gt;AtomFeedItem;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_4.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_thumb_4.png" width="592" height="484"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The idea of this &lt;strong&gt;AtomFeedReader&lt;/strong&gt; is that I construct it with a &lt;strong&gt;SearchTerm&lt;/strong&gt; and then I can go and call &lt;strong&gt;DequeueTopItem. &lt;/strong&gt;What it then does;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Checks its list of &lt;strong&gt;queuedItems&lt;/strong&gt; to see if there is an &lt;strong&gt;AtomFeedItem&lt;/strong&gt; at the top of that queue. If so, return it. 
&lt;li&gt;If not, begin an async download to hit Twitter, get the Atom feed for the search term, convert the items found there to &lt;strong&gt;AtomFeedItems&lt;/strong&gt; and enqueue them hoping that someone will later call &lt;strong&gt;DequeueTopItem&lt;/strong&gt; and then this time they'll get some data.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;So...pretty simple stuff and &lt;strong&gt;AtomFeedReader&lt;/strong&gt; is expected to be called on some kind of timer with the caller trying &lt;strong&gt;DequeueTopItem&lt;/strong&gt; to see if anything's available. I'll come back to &lt;strong&gt;HasImageNeedingDownload&lt;/strong&gt; at a later point as it's not obvious at all.&lt;/p&gt;
&lt;p&gt;What I need now is a class to tie together multiple of these &lt;strong&gt;AtomFeedReader&lt;/strong&gt; classes based on my configuration and poll them from time to time to see if they've got any interesting data. I wrote that class and it's not so big so I'll paste it here;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AtomFeedManager
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; EventHandler&amp;lt;AtomFeedItemAvailableEventArgs&amp;gt; FeedItemAvailable;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; EventHandler&amp;lt;AtomFeedItemUnavailableEventArgs&amp;gt; FeedItemUnavailable;

    &lt;span class="kwrd"&gt;public&lt;/span&gt; AtomFeedManager(SearchTermsConfiguration searchTerms,
      TimeSpan timerInterval)
    {
      &lt;span class="kwrd"&gt;this&lt;/span&gt;.searchTerms = searchTerms;

      lastTimeOfFeedItem = DateTime.Now;
      
      currentIndex = &lt;span class="kwrd"&gt;new&lt;/span&gt; ModuloInt(searchTerms.Count);

      InitialiseReaders();

      OnTimerElapsed(&lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);

      timer = &lt;span class="kwrd"&gt;new&lt;/span&gt; Timer(timerInterval.TotalMilliseconds);
      timer.Elapsed += OnTimerElapsed;
      timer.Start();
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; InitialiseReaders()
    {
      readers = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;AtomFeedReader&amp;gt;();

      &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SearchTerm term &lt;span class="kwrd"&gt;in&lt;/span&gt; searchTerms)
      {
        readers.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedReader(term));
      }
    }
    &lt;span class="kwrd"&gt;void&lt;/span&gt; OnTimerElapsed(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, ElapsedEventArgs e)
    {
      &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex = currentIndex;
      AtomFeedReader reader = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
      AtomFeedItem item = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

      &lt;span class="kwrd"&gt;while&lt;/span&gt; (item == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
      {
        reader = readers[currentIndex];
        item = reader.DequeueTopItem();

        currentIndex++;

        &lt;span class="kwrd"&gt;if&lt;/span&gt; (currentIndex == startIndex)
        {
          &lt;span class="kwrd"&gt;break&lt;/span&gt;;
        }
      }

      &lt;span class="kwrd"&gt;if&lt;/span&gt; (item != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
      {
        lastTimeOfFeedItem = DateTime.Now;
      }

      &lt;span class="kwrd"&gt;if&lt;/span&gt; ((item != &lt;span class="kwrd"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (FeedItemAvailable != &lt;span class="kwrd"&gt;null&lt;/span&gt;))
      {
        FeedItemAvailable(&lt;span class="kwrd"&gt;this&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedItemAvailableEventArgs()
        {
          SearchTerm = reader.SearchTerm,
          FeedItem = item
        });
      }
      &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; ((item == &lt;span class="kwrd"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (FeedItemUnavailable != &lt;span class="kwrd"&gt;null&lt;/span&gt;))
      {
        FeedItemUnavailable(&lt;span class="kwrd"&gt;this&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedItemUnavailableEventArgs()
        {
          UnavailableTime = DateTime.Now - lastTimeOfFeedItem 
        });
      }
    }
    List&amp;lt;AtomFeedReader&amp;gt; readers;
    SearchTermsConfiguration searchTerms;
    Timer timer;
    ModuloInt currentIndex;
    DateTime lastTimeOfFeedItem;
  }&lt;/pre&gt;
&lt;p&gt;You can see that it sets up a set of &lt;strong&gt;AtomFeedReader&lt;/strong&gt; based on the &lt;strong&gt;SearchTermsConfiguration&lt;/strong&gt; that's passed to it and then it ticks on a timer. On each timer tick, it goes to each &lt;strong&gt;AtomFeedReader&lt;/strong&gt; and calls &lt;strong&gt;DequeueTopItem&lt;/strong&gt;. It does this until any reader produces an item or until we've exhausted the set.&lt;/p&gt;
&lt;p&gt;Then we fire one of two events - &lt;strong&gt;FeedItemAvailable&lt;/strong&gt; or &lt;strong&gt;FeedItemUnavailable&lt;/strong&gt; to notify any interested parties that we either found something interesting or we didn't. Those events either carry the details of the new &lt;strong&gt;AtomFeedItem&lt;/strong&gt; that's become available or they carry a &lt;strong&gt;TimeSpan&lt;/strong&gt; which says how long it is since we last saw a new &lt;strong&gt;AtomFeedItem&lt;/strong&gt; from anywhere.&lt;/p&gt;
&lt;p&gt;So...putting all these classes together into a library that I'll call &lt;strong&gt;TwitterAtomFeedLibrary&lt;/strong&gt; I can go and write code against them like;&lt;/p&gt;&lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;class&lt;/span&gt; Program
  {
    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; WriteColour(ConsoleColor color,
      &lt;span class="kwrd"&gt;string&lt;/span&gt; formatString, &lt;span class="kwrd"&gt;params&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] args)
    {
      Console.ForegroundColor = color;
      Console.WriteLine(formatString, args);
      Console.ResetColor();
    }
    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
    {
      &lt;span class="rem"&gt;// Load my configured search terms&lt;/span&gt;
      SearchTermsConfiguration config = SearchTermsConfiguration.LoadFromConfig();

      &lt;span class="rem"&gt;// Set up my feed manager on a 5 second interval&lt;/span&gt;
      AtomFeedManager feedManager = &lt;span class="kwrd"&gt;new&lt;/span&gt; AtomFeedManager(config, &lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 5));

      &lt;span class="rem"&gt;// Handle events&lt;/span&gt;
      feedManager.FeedItemAvailable += (s, e) =&amp;gt;
        {
          WriteColour(ConsoleColor.Yellow, &lt;span class="str"&gt;"Feed item available for search term {0}"&lt;/span&gt;,
            e.SearchTerm.Term);

          WriteColour(ConsoleColor.Green, &lt;span class="str"&gt;"\tAuthor:{0}"&lt;/span&gt;, e.FeedItem.Author);
          WriteColour(ConsoleColor.Green, &lt;span class="str"&gt;"\tAuthor Image:{0}"&lt;/span&gt;, e.FeedItem.AuthorImageUri);
          WriteColour(ConsoleColor.Green, &lt;span class="str"&gt;"\tTitle: [{0}]"&lt;/span&gt;, e.FeedItem.Title);
          WriteColour(ConsoleColor.Green, &lt;span class="str"&gt;"\tPublished Date: {0}"&lt;/span&gt;, e.FeedItem.PublishedDate.ToShortDateString());
        };

      feedManager.FeedItemUnavailable += (s, e) =&amp;gt;
        {
          WriteColour(ConsoleColor.Cyan, &lt;span class="str"&gt;"No feed items available for {0} seconds"&lt;/span&gt;,
            e.UnavailableTime.TotalSeconds);
        };

      &lt;span class="rem"&gt;// Sit back and relax&lt;/span&gt;
      Console.ReadLine();
    }
  }&lt;/pre&gt;
&lt;p&gt;and it throws out content like this from the Console;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_5.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart2_CAB9/image_thumb_5.png" width="644" height="297"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now that I've got this &lt;strong&gt;AtomFeedManager&lt;/strong&gt; class and its friends like &lt;strong&gt;SearchTerm&lt;/strong&gt; I can go and put a WPF UI onto them which is where I'll head in the next post.&lt;/p&gt;
&lt;p&gt;Meanwhile, the sourcecode from this post (with the little test program code above) is all &lt;a href="http://mtaulty.com/downloads/TwitterAtomFeedLibrary.zip"&gt;here for download&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10897" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>WPF and &amp;quot;Twistori&amp;quot;: Part 1</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/19/10896.aspx</link><pubDate>Wed, 19 Nov 2008 11:10:13 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10896</guid><dc:creator>mtaulty</dc:creator><slash:comments>4</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10896.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10896</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;I don't really use &lt;a&gt;Twitter&lt;/a&gt; but I'm surrounded by folks that do and I'm more and more aware of its impact as if you turn up to any kind of event or gathering these days then you'll know that someone will come along and say whether it's being reported well/badly in the various tweets that it's generating.&lt;/p&gt; &lt;p&gt;Because of this, I wasn't aware of "Twistori" but &lt;a href="http://www.marcmywords.org/"&gt;Marc&lt;/a&gt; pointed it out to me the other week and said that it'd be cool if we had an internal application that did something similar that we could maybe use to display on a plasma TV somewhere or perhaps on a projector.&lt;/p&gt; &lt;p&gt;So, I set about building something simple with WPF that uses the Twitter (RESTful) API ( I stress that word "simple" as I didn't really want to go off into days and days of effort :-) and so I thought I'd share that here.&lt;/p&gt; &lt;p&gt;Ultimately, the application ended up looking like this;&lt;/p&gt; &lt;p&gt;&lt;a href="http://mtaulty.com/blog/images/WPFandTwistoriPart1_C45F/image.png"&gt;&lt;img border="0" alt="image" src="http://mtaulty.com/blog/images/WPFandTwistoriPart1_C45F/image_thumb.png" width="644" height="404"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;and it has an application configuration file that looks like this;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;section&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="searchTermsConfiguration"&lt;/span&gt;
             &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="SearchTermsConfig.SearchTermsConfiguration,TwitterAtomFeedLibrary"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  
  &lt;span class="rem"&gt;&amp;lt;!-- Set language to "en", "fr", etc. --&amp;gt;&lt;/span&gt;
  
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTermsConfiguration&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="en"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="rem"&gt;&amp;lt;!-- isIncluded is a bool (true/false) which can be changed in the UI anyway --&amp;gt;&lt;/span&gt;      
      &lt;span class="rem"&gt;&amp;lt;!-- filter is an enum which can be;&lt;/span&gt;
&lt;span class="rem"&gt;            Positive&lt;/span&gt;
&lt;span class="rem"&gt;            Negative&lt;/span&gt;
&lt;span class="rem"&gt;            PositiveAndNegative (not the same as "All" below)&lt;/span&gt;
&lt;span class="rem"&gt;            All&lt;/span&gt;
&lt;span class="rem"&gt;      --&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerm&lt;/span&gt; &lt;span class="attr"&gt;term&lt;/span&gt;&lt;span class="kwrd"&gt;="Microsoft"&lt;/span&gt;
                  &lt;span class="attr"&gt;isIncluded&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;
                  &lt;span class="attr"&gt;filter&lt;/span&gt;&lt;span class="kwrd"&gt;="All"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;searchTerm&lt;/span&gt; &lt;span class="attr"&gt;term&lt;/span&gt;&lt;span class="kwrd"&gt;="Windows"&lt;/span&gt;
                  &lt;span class="attr"&gt;isIncluded&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;
                  &lt;span class="attr"&gt;filter&lt;/span&gt;&lt;span class="kwrd"&gt;="All"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;searchTerms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;searchTermsConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;which drives what it does which is, essentially;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Wake up every N seconds 
&lt;li&gt;Visit the next search term in the list up on the left (Microsoft, Windows, etc) that has flagged itself as being active 
&lt;li&gt;Check to see if we have some stored ATOM items for that search term. If not, go grab up some of those things from Twitter and move to the next term whilst they download asynchronously 
&lt;li&gt;Once we find an ATOM item, display it in the area on the right of the screen and highlight which search term it relates to in the listbox on the left hand side of the screen.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;so, it's pretty simple and the UI largely involves a ListBox, some CheckBoxes, some TextBlocks, an Image and a few layout panels and animations.&lt;/p&gt;
&lt;p&gt;Note that the background image is taken from &lt;a href="http://www.hdwallpapers.net"&gt;www.hdwallpapers.net&lt;/a&gt; so I'm not sure whether I should really be distributing it like this and I'll take it out if someone asks me to.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://mtaulty.com/downloads/WpfTwistori.zip"&gt;Here's the app for download&lt;/a&gt;. All bugs mine (of course) and I know there's one or two in there. The next post will start to look at putting something very similar to this together.&lt;/p&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10896" width="1" height="1"&gt;</description><category domain="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1012.aspx">WPF</category></item><item><title>Windows 7: Starting at the Beginning</title><link>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/11/11/10892.aspx</link><pubDate>Tue, 11 Nov 2008 17:51:52 GMT</pubDate><guid isPermaLink="false">c62f47b3-9054-4265-9c0c-549d811810c2:10892</guid><dc:creator>mtaulty</dc:creator><slash:comments>0</slash:comments><comments>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/comments/10892.aspx</comments><wfw:commentRss>http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/commentrss.aspx?PostID=10892</wfw:commentRss><description>&lt;p&gt;My previous post around the location and sensor platform in Windows 7 came a little bit out of context so apologies for that although I have since watched the PDC session and it's well worth watching.&lt;/p&gt; &lt;p&gt;However...if you want to start at the beginning with Windows 7 then there's the Developer Guide which you can download from here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=Win7DeveloperGuide&amp;amp;ReleaseId=1702"&gt;Developer Guide&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;and you should also make sure that you're subscribed to Yochay's blog which is up here;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/yochay/default.aspx"&gt;The Windows 7 Blog for Developers&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://mtaulty.com/CommunityServer/aggbug.aspx?PostID=10892" width="1" height="1"&gt;</description></item></channel></rss>