<?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>Quickduck &#187; WPF</title>
	<atom:link href="http://quickduck.com/blog/category/development/net/wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://quickduck.com/blog</link>
	<description>Straight from the mind of geniuseseses....</description>
	<lastBuildDate>Wed, 30 Jun 2010 10:52:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Creating your own ContentTemplates in WPF</title>
		<link>http://quickduck.com/blog/2009/12/23/creating-your-own-contenttemplates-in-wpf/</link>
		<comments>http://quickduck.com/blog/2009/12/23/creating-your-own-contenttemplates-in-wpf/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 12:00:36 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=244</guid>
		<description><![CDATA[This isn&#8217;t something that I do often, but rolling your own look-and-feel by starting a ContentTemplate from scratch can be a right pain in the botty. Today I found this excellent sample project from Microsoft, which contains custom ContentTemplates for most UI controls in the framework. It provides an excellent starting point for creating your [...]]]></description>
			<content:encoded><![CDATA[<p>This isn&#8217;t something that I do often, but rolling your own look-and-feel by starting a ContentTemplate from scratch can be a right pain in the botty. Today I found <a href="http://msdn.microsoft.com/en-us/library/ms771597.aspx">this excellent sample project from Microsoft</a>, which contains custom ContentTemplates for most UI controls in the framework. It provides an excellent starting point for creating your own customized controls.</p>
<p>Check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2009/12/23/creating-your-own-contenttemplates-in-wpf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using a generic base class control in WPF</title>
		<link>http://quickduck.com/blog/2009/06/26/using-a-generic-base-class-control-in-wpf/</link>
		<comments>http://quickduck.com/blog/2009/06/26/using-a-generic-base-class-control-in-wpf/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 10:28:18 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/?p=100</guid>
		<description><![CDATA[One thing that I find myself doing all the time is creating some type of base class for my windows/controls in WPF: namespace Editors { public class EntityEditorControlBase&#60;TModel&#62; : UserControl where TModel : class, IEntityEditorModel { public TModel Model { get { return DataContext as TModel; } protected set { DataContext = value; } } [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that I find myself doing all the time is creating some type of base class for my windows/controls in WPF:</p>
<pre><code style="font-size:125%">
namespace Editors {
    public class EntityEditorControlBase&lt;TModel&gt; : UserControl
        where TModel : class, IEntityEditorModel {

        public TModel Model {
            get { return DataContext as TModel; }
            protected set { DataContext = value; }
        }
    }
}
</code></pre>
<p>Since this is a generic control you need to specify the concrete type arguments when you subclass it. You can do this in your WPF markup via the <strong>x:TypeArguments</strong> attribute:</p>
<pre><code style="font-size:125%">
&lt;Editors:EntityEditorControlBase
    x:Class="ConcreteEntityEditorControl"
    <strong>x:TypeArguments="Models:ConcreteEntityEditorControlModel"</strong>
    xmlns:Editors="clr-namespace:Editors"&gt;

    &lt;UserControl.Resources&gt;
        &lt;ResourceDictionary Source="../Resources/EditorResources.xaml" /&gt;
    &lt;/UserControl.Resources&gt;

    &lt;!-- control content here --&gt;

&lt;/Editors:EntityEditorControlBase&gt;
</code></pre>
<p>Two important things to note:</p>
<ul>
<li>When you want to attach a resource dictionary to the class, you need to do so using the <strong>&lt;UserControl.Resources&gt;</strong> tag</li>
<li>In your base class control, make sure you include the [ContentProperty("Content")] and [DefaultProperty("Content")] tags on your class to avoid the horrible &#8220;<a href="http://msdn.microsoft.com/en-us/library/bb514660.aspx">The type &#8216;{0}&#8217; does not support direct content</a>&#8221; error.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2009/06/26/using-a-generic-base-class-control-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StaticResource vs DynamicResource</title>
		<link>http://quickduck.com/blog/2008/06/17/staticresource-vs-dynamicresource/</link>
		<comments>http://quickduck.com/blog/2008/06/17/staticresource-vs-dynamicresource/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 15:35:45 +0000</pubDate>
		<dc:creator>Gerrod</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://quickduck.com/blog/2008/06/17/staticresource-vs-dynamicresource/</guid>
		<description><![CDATA[I&#8217;ve been focusing a lot (read: &#8220;learning&#8221;) on WPF lately, and one thing that crops up all the time is StaticResource and DynamicResource. I had tried to infer their usage/differences from the context of where I&#8217;d seen them used, but I could never quite get it right. Anyway, I just read a nice definition which [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been focusing a lot (read: &#8220;learning&#8221;) on WPF lately, and one thing that crops up all the time is StaticResource and DynamicResource. I had tried to infer their usage/differences from the context of where I&#8217;d seen them used, but I could never quite get it right. Anyway, I just read a nice definition which makes it all rather clear:</p>
<blockquote><p>
Static resources are resolved at compile time, whereas dynamic resources are resolved at runtime.</p>
<p>Use DynamicResources when the value of the resource could change during the lifetime of the Application.</p>
<p>Use StaticResources when it’s clear that you don’t need your resource re-evaluated when fetching it – static resources perform better than dynamic resources.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://quickduck.com/blog/2008/06/17/staticresource-vs-dynamicresource/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
