<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lapthorn.net</title>
	<atom:link href="http://www.lapthorn.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.lapthorn.net</link>
	<description>(*this).that(&#38;theOther);</description>
	<lastBuildDate>Wed, 01 Feb 2012 15:44:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MVVMLight Using Two Views</title>
		<link>http://www.lapthorn.net/archives/600</link>
		<comments>http://www.lapthorn.net/archives/600#comments</comments>
		<pubDate>Tue, 31 Jan 2012 16:42:40 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[mvvmlight]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=600</guid>
		<description><![CDATA[In the previous article, I quickly showed how to create a single-view, single-window WPF application using MVVM Light. The trend in WPF applications is to have a single window holding multiple views so that there are less pop-up dialogs or &#8230; <a href="http://www.lapthorn.net/archives/600">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view1.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view1-150x119.png" alt="" title="mvvmlight_view1" width="150" height="119" class="alignleft size-thumbnail wp-image-601" /></a></p>
<p>In the <a href="http://www.lapthorn.net/archives/579">previous article</a>, I quickly showed how to create a single-view, single-window WPF application using MVVM Light.  The trend in WPF applications is to have a single window holding multiple views so that there are less pop-up dialogs or child windows.  This article shows how to construct a simple two view application using MVVM and WPF.</p>
<h2>Getting Started</h2>
<ul>
<li>Requires VS2010</li>
<li>Ensure that you have <a href="http://nuget.org/">Nuget</a> installed.</li>
<li>Manage Nuget Package References and add <a href="http://mvvmlight.codeplex.com/">MVVM Light</a></li>
<li>The example code for this article is on <a href="https://github.com/barrylapthorn/MvvmLightExamples">github</a>.</li>
</ul>
<p>  Note that the XAML, in particular, is elided for brevity and you should go to the git repository for the original code.</p>
<h2>Hosting Multiple Views</h2>
<p>The application structure is similar to the previous article:  we have a <code>MainWindow</code>, a <code>ViewModelLocator</code>, and a <code>MainViewModel</code>.</p>
<p>A picture is worth a thousand words, so without further ado, here is what the project structure looks like in VS2010:</p>
<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_vs.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_vs.png" alt="" title="mvvmlight_vs" width="218" height="284" class="alignleft size-full wp-image-603" /></a></p>
<p>The project is laid out in typical MVVM style:  3 folders for <code>Models</code>, <code>ViewModels</code>, and <code>Views</code>.  In this case we do not have any <code>Models</code> so they can be ignored.</p>
<p>Starting with the <code>Views</code>:  we simply have two <code>UserControl</code> XAML files, that have contain the views that we want to render.  The first view is the one from the previous article.  The second is just a text label.</p>
<p>All the work involved in rendering two different views for two different view-models happens in <code>MainViewModel.cs</code>, <code>MainWindow.xaml</code>, and <code>App.xaml</code>.</p>
<p>Looking at the <code>MainWindow</code> XAML, we see the following;</p>
<pre>&lt;Window x:Class="TwoViews.MainWindow"
        DataContext="{Binding Main,
                              Source={StaticResource Locator}}"&gt;
    &lt;Grid&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height="Auto" /&gt;
            &lt;RowDefinition Height="Auto" /&gt;
        &lt;/Grid.RowDefinitions&gt;

        &lt;ContentControl Content="{Binding CurrentViewModel}" /&gt;

        &lt;DockPanel Grid.Row="1" &gt;
            &lt;Button Command="{Binding SecondViewCommand}"
                    Content="Second View"
                    DockPanel.Dock="Right" /&gt;
            &lt;Button Command="{Binding FirstViewCommand}"
                    Content="First View"
                    DockPanel.Dock="Left" /&gt;
        &lt;/DockPanel&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</pre>
<p>As before, we use the <code>ViewModelLocator</code> to bind our <code>Main</code> view model to the <code>MainWindow</code>.  This time, however, we have a <code>ContentControl</code> that binds to a new property called <code>CurrentViewModel</code>, and two buttons that bind to commands that switch the <em>view models</em>.  Even though the buttons are labelled as switching the views, it is actually the view-models that are updated.</p>
<p>The next step in getting this to work, is implementing a <code>DataTemplate</code>, <em>per view model</em> that renders a <code>View</code> associated with a <code>ViewModel</code>.  We do this in the <code>App.xaml</code> (though we could do it any <code>Resource</code>  section we choose):</p>
<pre>&lt;Application x:Class="TwoViews.App"
             xmlns:views="clr-namespace:TwoViews.Views"
             xmlns:vm="clr-namespace:TwoViews.ViewModels"
             StartupUri="MainWindow.xaml"
             &gt;
    &lt;Application.Resources&gt;
        &lt;vm:ViewModelLocator x:Key="Locator"  /&gt;
        &lt;DataTemplate DataType="{x:Type vm:SecondViewModel}"&gt;
            &lt;views:SecondView /&gt;
        &lt;/DataTemplate&gt;
        &lt;DataTemplate DataType="{x:Type vm:FirstViewModel}"&gt;
            &lt;views:FirstView /&gt;
        &lt;/DataTemplate&gt;
    &lt;/Application.Resources&gt;
&lt;/Application&gt;
</pre>
<p>For example, this quite literally says &#8216;if my data type is <code>FirstViewModel</code>, then the WPF framework should render the <code>FirstView</code> <code>UserControl</code>. </p>
<p>So when the <code>Content</code> attribute of our the <code>ContentControl</code> is set to an object of type <code>FirstViewModel</code> the <em>framework renders the correct <code>View</code> for us</em>.</p>
<p>It should also be noted that because the <code>Content</code> attribute has been set to a particular <code>ViewModel</code>, for example <code>FirstViewModel</code>, it is also set as the <code>DataContext</code> for the view that is rendered, i.e. <code>FirstView</code>, and the data-binding between <code>FirstView</code> and <code>FirstViewModel</code> therefore work.</p>
<p>The last part of the application that wires all of this together is the <code>MainViewModel</code> class.  Clearly we only want a single instance of each view model, so we just declare static instances of each one:</p>
<pre class="brush: csharp; title: ; notranslate" title="">public class MainViewModel : ViewModelBase
{
    private ViewModelBase _currentViewModel;

    readonly static FirstViewModel _firstViewModel = new FirstViewModel();
    readonly static SecondViewModel _secondViewModel = new SecondViewModel();

    public ViewModelBase CurrentViewModel
    {
        get
        {
            return _currentViewModel;
        }
        set
        {
            if (_currentViewModel == value)
                return;
            _currentViewModel = value;
            RaisePropertyChanged("CurrentViewModel");
        }
    }

    public ICommand FirstViewCommand { get; private set; }
    public ICommand SecondViewCommand { get; private set; }

    public MainViewModel()
    {
        CurrentViewModel = MainViewModel._firstViewModel;
        FirstViewCommand = new RelayCommand(() =&gt; ExecuteFirstViewCommand());
        SecondViewCommand = new RelayCommand(() =&gt; ExecuteSecondViewCommand());
    }         

    private void ExecuteFirstViewCommand()
    {
        CurrentViewModel = MainViewModel._firstViewModel;
    }

    private void ExecuteSecondViewCommand()
    {
        CurrentViewModel = MainViewModel._secondViewModel;
    }
}
</pre>
<p>Note that in the <code>CurrentViewModel</code> property we also have to <code>RaisePropertyChanged</code> via the INPC interface that <code>ViewModelBase</code> defines.  This is so that the data-binding works in WPF, i.e. when we click on the buttons the view changes:  <em>if this line is omitted, you cannot change the views by clicking on the buttons</em>.</p>
<p>If we run the code we can now see that we can switch between the two views and both views maintain their state (as we are using a static instance of each):</p>
<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view1.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view1.png" alt="" title="mvvmlight_view1" width="181" height="119" class="alignleft size-full wp-image-601" /></a></p>
<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view2.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_view2.png" alt="" title="mvvmlight_view2" width="185" height="102" class="alignleft size-full wp-image-602" /></a></p>
<h2>Finishing Off</h2>
<p>You might feel that the code above looks repetitive:  it is.  Many, if not all, MVVM frameworks provided &#8216;runtime assistance&#8217; in automating this kind of thing.  By that I mean that by naming your classes according to <em>convention</em>, e.g. by always using the &#8216;View&#8217; and &#8216;ViewModel&#8217; suffixes, MVVM frameworks heavily use reflection and can associate your views and view-models at run time.  Indeed, even the <code>MainViewModel</code> above is often generalised into something that is provided by the MVVM framework. </p>
<h2>Footnotes</h2>
<p>Previous articles/further reading:</p>
<ul>
<li><a href="http://www.codeproject.com/Articles/165368/WPF-MVVM-Quick-Start-Tutorial">An MVVM Quick Start</a></li>
<li><a href="http://www.lapthorn.net/archives/579">MVVM Light Hello World</a></li>
</ul>
<p>The example code is on <a href="https://github.com/barrylapthorn/MvvmLightExamples">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/600/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVVMLight Hello World in 10 Minutes.</title>
		<link>http://www.lapthorn.net/archives/579</link>
		<comments>http://www.lapthorn.net/archives/579#comments</comments>
		<pubDate>Mon, 30 Jan 2012 13:46:16 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[mvvmlight]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=579</guid>
		<description><![CDATA[This article shows a trivial &#8216;Hello World&#8217; MVVM WPF application using the MVVM Light library. Getting Started Firstly, start VS2010, and create a new WPF project. Ensure that you have Nuget installed. Manage Nuget Package References and add &#8216;MVVM Light&#8217; &#8230; <a href="http://www.lapthorn.net/archives/579">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_helloworld.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_helloworld-150x150.png" alt="" title="mvvmlight_helloworld" width="150" height="150" class="alignleft size-thumbnail wp-image-580" /></a></p>
<p>This article shows a trivial &#8216;Hello World&#8217; MVVM WPF application using the <a href='http://mvvmlight.codeplex.com/'>MVVM Light library</a>.</p>
<h2>Getting Started</h2>
<ul>
<li>Firstly, start VS2010, and create a new WPF project.</li>
<li>Ensure that you have <a href="">Nuget</a> installed.</li>
<li>Manage Nuget Package References and add &#8216;MVVM Light&#8217;</li>
</ul>
<p><a href="http://mvvmlight.codeplex.com/">MVVM Light</a> has now added a <code>ViewModel</code> folder containing the <code>MainViewModel</code> and the <code>ViewModelLocator</code>.</p>
<h2>Edit the Main Window</h2>
<p>Simply add a button, and defer the <code>DataContext</code> binding to the <code>ViewModelLocator</code> (elided):</p>
<pre><code>&lt;Window x:Class="MvvmLightTest.MainWindow"
        DataContext="{Binding Main,
                              Source={StaticResource Locator}}"&gt;
    &lt;Grid&gt;
        &lt;Button Command="{Binding ShowPopUp}" Content="Show Pop Up" /&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre>
<p>Then in the <code>MainViewModel</code> we define the <code>ShowPopUp</code> command:</p>
<pre class="brush: csharp; title: ; notranslate" title="">public class MainViewModel : ViewModelBase
{
    public MainViewModel()
    {
        ShowPopUp = new RelayCommand(() =&gt; ShowPopUpExecute(), () =&gt; true);
    }

    public ICommand ShowPopUp { get; private set; }

    private void ShowPopUpExecute()
    {
        MessageBox.Show("Hello!");
    }
}
</pre>
<p>Compile the code, and we get:</p>
<p>
<a href="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_helloworld.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/mvvmlight_helloworld.png" alt="" title="mvvmlight_helloworld" width="333" height="173"  /></a>
</p>
<p>The <code>MainViewModel</code> inherits from the <code>ViewModelBase</code> class which also gives us the <code>RaisePropertyChanged</code> method, which we would call if we change the value of a property that we bind to (see <a href="http://www.codeproject.com/Articles/165368/WPF-MVVM-Quick-Start-Tutorial">this CodeProject article</a> for more information).  An example of property data-binding is also included in the example code.</p>
<h2>How does all this work?</h2>
<p>Firstly, our <code>App.xaml</code> contains an application wide instance of the <code>ViewModelLocator</code>:</p>
<pre><code>&lt;Application x:Class="MvvmLightTest.App"
             xmlns:vm="clr-namespace:MvvmLightTest.ViewModel"
             StartupUri="MainWindow.xaml"&gt;
    &lt;Application.Resources&gt;
        &lt;vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /&gt;
    &lt;/Application.Resources&gt;
&lt;/Application&gt;
</code></pre>
<p>We then defer the <code>DataContext</code> binding to the <code>ViewModelLocator</code> (elided) in the <code>MainWindow</code>:</p>
<pre><code>&lt;Window x:Class="MvvmLightTest.MainWindow"
        DataContext="{Binding Main,
                              Source={StaticResource Locator}}"&gt;
    &lt;Grid&gt;
        &lt;Button Command="{Binding ShowPopUp}" Content="Show Pop Up" /&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre>
<p>This simply returns the static instance of the <code>MainViewModel</code> held in the <code>ViewModelLocator</code> instance.</p>
<p>The example code is on <a href="https://github.com/barrylapthorn/MvvmLightExamples">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/579/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Git</title>
		<link>http://www.lapthorn.net/archives/565</link>
		<comments>http://www.lapthorn.net/archives/565#comments</comments>
		<pubDate>Mon, 23 Jan 2012 15:33:27 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[DVCS]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=565</guid>
		<description><![CDATA[Since I&#8217;m using git a little bit more often now, this is just a little note to remind me how to do things in git that I would usually do in svn or hg. Yet another git cheatsheet! Reverting This &#8230; <a href="http://www.lapthorn.net/archives/565">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2011/12/git.png"><img src="http://www.lapthorn.net/wp-content/uploads/2011/12/git-94x150.png" alt="" title="git" width="94" height="150" class="alignleft size-thumbnail wp-image-512" /></a></p>
<p>Since I&#8217;m using <code>git</code> a little bit more often now, this is just a little note to remind me how to do things in <code>git</code> that I would usually do in <code>svn</code> or <code>hg</code>.  Yet another <code>git</code> cheatsheet!</p>
<h2>Reverting</h2>
<p>This is quite straightforward for my purposes:</p>
<pre><code>git reset --hard HEAD
</code></pre>
<p>Running just <code>git reset -h</code> gives:</p>
<pre><code>usage: git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [&lt;commit&gt;]
   or: git reset [-q] &lt;commit&gt; [--] &lt;paths&gt;...
   or: git reset --patch [&lt;commit&gt;] [--] [&lt;paths&gt;...]

    -q, --quiet           be quiet, only report errors
    --mixed               reset HEAD and index
    --soft                reset only HEAD
    --hard                reset HEAD, index and working tree
    --merge               reset HEAD, index and working tree
    --keep                reset HEAD but keep local changes
    -p, --patch           select hunks interactively
</code></pre>
<h2>Cleaning up</h2>
<p>To revert files use:</p>
<pre><code>git clean
</code></pre>
<p>with <code>-h</code>:</p>
<pre><code>usage: git clean [-d] [-f] [-n] [-q] [-e &lt;pattern&gt;] [-x | -X] [--] &lt;paths&gt;...

    -q, --quiet           do not print names of files removed
    -n, --dry-run         dry run
    -f, --force           force
    -d                    remove whole directories
    -e, --exclude &lt;pattern&gt;
                          add &lt;pattern&gt; to ignore rules
    -x                    remove ignored files, too
    -X                    remove only ignored files
</code></pre>
<p>If you just want to remove ignored files, run git clean -f -X.<br />
One nice feature is that you can get back to a clean working copy by doing:</p>
<pre><code>git clean -f -x
</code></pre>
<h2>Moving and Committing.</h2>
<p>One very nice feature of <code>git</code> is that you can move files around using the operating system commands, and <code>git</code> tracks the moves automatically.</p>
<p>Untracked files still need to be added via <code>git add</code>, and then <code>git commit --all</code> is the closest analogy to <code>svn commit</code>. </p>
<p>Although a little confusing at first, most <code>git</code> commands do nothing unless you specify a particular argument.  Compare this to Subversion:  I can&#8217;t recall the number of times that people have made accidental commits because Subversion just blindly commits everything.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/565/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A WPF TimeSpan Custom Control</title>
		<link>http://www.lapthorn.net/archives/557</link>
		<comments>http://www.lapthorn.net/archives/557#comments</comments>
		<pubDate>Thu, 19 Jan 2012 14:32:32 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=557</guid>
		<description><![CDATA[I have added yet another CodeProject article entitled A WPF Short TimeSpan Custom Control that builds up on my previous article that creates a simple spinner control. The introduction to the article is here, but go to the CodeProject web &#8230; <a href="http://www.lapthorn.net/archives/557">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/timespan_example.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/timespan_example-150x34.png" alt="" title="timespan_example" width="150" height="34" class="alignleft size-thumbnail wp-image-558" /></a></p>
<p>I have added yet another CodeProject article entitled <a href='http://www.codeproject.com/KB/WPF/btl_timespancustomcontrol.aspx'>A WPF Short TimeSpan Custom Control</a> that builds up on my previous article that creates a <a href="http://www.lapthorn.net/archives/547" title="A WPF Spinner Custom Control">simple spinner control.</a></p>
<p>The introduction to the article is here, but go to the CodeProject web site for the full article:</p>
<h2>Introduction</h2>
<p>In my previous two articles, I first described <a href="http://www.codeproject.com/KB/selection/btl_shorttimespan_control.aspx">a simple short TimeSpan UserControl</a> that used sliders to pick the hours, minutes, and seconds of a <code>TimeSpan</code>.  In my second article I described <a href="http://www.codeproject.com/KB/WPF/btl_spinner_control.aspx">a custom spinner control</a> that could be used to replace the sliders.</p>
<p>In this third article, I will update the <code>TimeSpan</code> control to use the <code>SpinnerControl</code>, and make the <code>TimeSpan</code> control a custom control, rather than a <code>UserControl</code> (in particular so that we can apply custom themes to it).  I refer to this as a <code>ShortTimeSpanControl</code> as it only represents a positive <code>TimeSpan</code> from 00:00:00 to 23:59:59.  A full <code>TimeSpan</code> is <a href="http://msdn.microsoft.com/en-us/library/269ew577(v=vs.100).aspx">described here</a>:</p>
<blockquote>
<p>A TimeSpan value can be represented as [-]d.hh:mm:ss.ff, where the optional minus sign indicates a negative time interval, the d component is days, hh is hours as measured on a 24-hour clock, mm is minutes, ss is seconds, and ff is fractions of a second. That is, a time interval consists of a positive or negative number of days without a time of day, or a number of days with a time of day, or only a time of day.</p>
</blockquote>
<p>With the generic theme supplied, this is a <em>selection</em> control, where the user can choose a <code>TimeSpan</code>.   As it is a custom control, you can apply any custom theme you like, and, perhaps, just make it a read-only control (interactively, that is), that updates its <code>Value</code> via data-binding.</p>
<p>&#8230;.read the full article at  <a href='http://www.codeproject.com/KB/WPF/btl_timespancustomcontrol.aspx'>A WPF Short TimeSpan Custom Control</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/557/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A WPF Spinner Custom Control</title>
		<link>http://www.lapthorn.net/archives/547</link>
		<comments>http://www.lapthorn.net/archives/547#comments</comments>
		<pubDate>Mon, 16 Jan 2012 15:20:01 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=547</guid>
		<description><![CDATA[I have added another article to Code Project: A WPF Spinner Custom Control which describes the process of creating a simple spinner control in WPF using the framework. This follows up from my previous post where I created a simple &#8230; <a href="http://www.lapthorn.net/archives/547">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/spinner_themed.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/spinner_themed-150x112.png" alt="" title="spinner_themed" width="150" height="112" class="alignleft size-thumbnail wp-image-554" /></a></p>
<p>I have added another article to Code Project:  <a href="http://www.codeproject.com/KB/WPF/btl_spinner_control.aspx">A WPF Spinner Custom Control</a> which describes the process of creating a simple spinner control in WPF using the framework.   </p>
<p>This follows up from my previous post <a href="http://www.lapthorn.net/archives/539" title="An Extremely Simple WPF TimeSpan Control"></a> where I created a simple <code>UserControl </code>to select a <code>TimeSpan</code>.   In the absence of a spinner control I used sliders instead.  Writing a spinner control has been an educational experience:  whilst I have previously written controls, writing a new one from scratch and adhering to the various framework guidelines and conventions (to a degree) meant that I had to read through much more of the MSDN documentation than I would previously have taken a look at.</p>
<p>What makes the article a little different to some of the others out there, is that I try and mention each part of a custom control:  the code, the generic theme, and then applying a custom theme to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/547/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Extremely Simple WPF TimeSpan Control</title>
		<link>http://www.lapthorn.net/archives/539</link>
		<comments>http://www.lapthorn.net/archives/539#comments</comments>
		<pubDate>Wed, 11 Jan 2012 13:34:29 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=539</guid>
		<description><![CDATA[I&#8217;ve just posted a new article on CodeProject: An Extremely Simple WPF TimeSpan Control, which &#8216;does what it says on the tin&#8217;: it&#8217;s an extremely simple TimeSpan for C# and WPF.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/shorttimespan.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/shorttimespan-150x142.png" alt="" title="shorttimespan" width="150" height="142" class="alignleft size-thumbnail wp-image-543" /></a>
<p>I&#8217;ve just posted a new article on CodeProject:  <a href='http://www.codeproject.com/KB/selection/btl_shorttimespan_control.aspx'>An Extremely Simple WPF TimeSpan Control</a>, which &#8216;does what it says on the tin&#8217;:  it&#8217;s an extremely simple <code>TimeSpan</code> for C# and WPF.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/539/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A WPF/MVVM Countdown Timer on GitHub</title>
		<link>http://www.lapthorn.net/archives/526</link>
		<comments>http://www.lapthorn.net/archives/526#comments</comments>
		<pubDate>Thu, 05 Jan 2012 16:37:23 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[DVCS]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=526</guid>
		<description><![CDATA[I have started working on a simple countdown timer that is written in C#, XAML, and uses the &#8216;MVVM&#8217; pattern. The v0.1 code is checked into GitHub, where you can download it, fork it, and play around (yes, I&#8217;m using &#8230; <a href="http://www.lapthorn.net/archives/526">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2012/01/CountdownTimer_256x256.png"><img src="http://www.lapthorn.net/wp-content/uploads/2012/01/CountdownTimer_256x256-150x150.png" alt="" title="CountdownTimer_256x256" width="150" height="150" class="alignleft size-thumbnail wp-image-527" /></a></p>
<p>I have started working on a simple countdown timer that is written in C#, XAML, and uses the &#8216;MVVM&#8217; pattern.  The <a href='http://semver.org/'>v0.1</a> code is  checked into <a href="https://github.com/barrylapthorn/countdown_timer" title="countdown timer">GitHub</a>, where you can download it, fork it, and play around (yes, I&#8217;m using <a href='http://semver.org/'>semantic versioning</a>).  The purpose of this is to refresh my memory about XAML, and C#, and also to play around with CodeRush and Refactor! that make writing C# much easier.</p>
<p>The version 0.1 features are:</p>
<ul>
<li>Countdown fixed and starts at <a href='http://www.pomodorotechnique.com/'>25 minutes</a>.</li>
<li>Plays a start/stop sound using the <code>SystemSounds</code>.</li>
<li>Settings not implemented.</li>
<li>The window stays top-most.</li>
<li>The Windows 7 taskbar icon shows the countdown progress.</li>
</ul>
<p>This will go up onto CodeProject, I expect, once I&#8217;ve finished it off.  The icon, if you are interested, was created using <a href='http://www.axialis.com/iconworkshop/'>Icon Workshop</a> which, at the time of writing, has money off.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/526/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a global gitignore on Windows</title>
		<link>http://www.lapthorn.net/archives/509</link>
		<comments>http://www.lapthorn.net/archives/509#comments</comments>
		<pubDate>Tue, 20 Dec 2011 14:02:27 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=509</guid>
		<description><![CDATA[I&#8217;m taking this as a reference for files that should be ignored by git: git &#8211; .gitignore for Visual Studio Projects and Solutions &#8211; Stack Overflow. Then copying them into .gitignore_global in %USERPROFILE% and then following these instructions http://help.github.com/ignore-files/ and &#8230; <a href="http://www.lapthorn.net/archives/509">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2011/12/git.png"><img src="http://www.lapthorn.net/wp-content/uploads/2011/12/git-94x150.png" alt="" title="git" width="94" height="150" class="alignleft size-thumbnail wp-image-512" /></a>
<p>I&#8217;m taking this as a reference for files that should be ignored by git:</p>
<p><a href='http://stackoverflow.com/questions/2143956/gitignore-for-visual-studio-projects-and-solutions'>git &#8211; .gitignore for Visual Studio Projects and Solutions &#8211; Stack Overflow</a>.</p>
<p>Then copying them into <code>.gitignore_global</code> in <code>%USERPROFILE%</code> and then following these instructions <a href='http://help.github.com/ignore-files/'>http://help.github.com/ignore-files/</a> and running:</p>
<p><code><br />
git config --global core.excludesfile ~/.gitignore_global<br />
</code></p>
<p>this now means that any <code>git add</code> only adds the files we care about such as source code and makefiles <i>etc.</i></p>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/509/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is a metaclass in Python?</title>
		<link>http://www.lapthorn.net/archives/502</link>
		<comments>http://www.lapthorn.net/archives/502#comments</comments>
		<pubDate>Sat, 17 Dec 2011 17:28:20 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=502</guid>
		<description><![CDATA[Here is an interesting question and answer on Python about meta-classes what meta-classes are and how Python defines and creates classes:What is a metaclass in Python? &#8211; Stack Overflow.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2011/12/python-logo.png"><img src="http://www.lapthorn.net/wp-content/uploads/2011/12/python-logo-150x71.png" alt="" title="python-logo" width="150" height="71" class="alignleft size-thumbnail wp-image-461" /></a>
<p>Here is an interesting question and answer on Python about meta-classes what meta-classes are and how Python defines and creates classes:<a href='http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python'>What is a metaclass in Python? &#8211; Stack Overflow</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/502/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Typeface for the Underground</title>
		<link>http://www.lapthorn.net/archives/495</link>
		<comments>http://www.lapthorn.net/archives/495#comments</comments>
		<pubDate>Sat, 17 Dec 2011 12:31:32 +0000</pubDate>
		<dc:creator>barry</dc:creator>
				<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.lapthorn.net/?p=495</guid>
		<description><![CDATA[I am a bit of a shameless fan of good design and typography, and I can&#8217;t believe I missed this article a couple of years back from the London Reconnections website. If you use the London Underground, here is a &#8230; <a href="http://www.lapthorn.net/archives/495">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lapthorn.net/wp-content/uploads/2011/12/LU-face.jpg"><img src="http://www.lapthorn.net/wp-content/uploads/2011/12/LU-face-150x150.jpg" alt="" title="LU-face" width="150" height="150" class="alignleft size-thumbnail wp-image-498" /></a>
<p>I am a bit of a shameless fan of good design and typography, and I can&#8217;t believe I missed this article a couple of years back from the London Reconnections website.  If you use the London Underground, here is a quick history of the old and new fonts used by LU:  <a href='http://www.londonreconnections.com/2009/a-typeface-for-the-underground/'>A Typeface for the Underground | London Reconnections</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lapthorn.net/archives/495/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

