<?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>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb2.png" width="305" height="240" /></a></p>  <p>Toggling between these states is as simply as setting a single property called IsBusy.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1b93d14-e297-411d-b217-3bd67de154a6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>online buying Zovirax</b>, <b>Low dose Zovirax</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> IsBusy</span><span style="color:#0000ff">=&quot;True&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>When the BusyIndicator.IsBusy property is set to True, <b>buy Zovirax from mexico</b>, <b>Zovirax wiki</b>, the BusyIndicator becomes visible and prevents any user interaction with the BusyIndicator’s Content.&#160; So any elements that you have defined within the Content of the BusyIndicator will be disabled.&#160; When the IsBusy property is set to False, the Content re-enables and user interaction can continue.</p>  <h4>The Common Problem</h4>  <p>The most common problem I see when people are having trouble using the BusyIndicator is that they are doing everything on the UI thread.&#160; Let’s look at an example:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:050d7667-af12-43ac-bd08-8e7e1fcb6685" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax trusted pharmacy reviews</b>, <b>Zovirax gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>The event handler for the button looks like this:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507b5dfc-48bb-436e-9fe7-003d2f63d756" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>order Zovirax from United States pharmacy</b>, <b>Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>canada, mexico, india</b>, <b>Zovirax images</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#008000">//show BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     <br>     <span style="color:#008000">//long running process</span><br>     <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>     {<br>         System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>     }<br> <br>     <span style="color:#008000">//hide BusyIndicator</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br> }</div> </div> </div> </p>  <p>Now the assumption is that first the BusyIndicator will be shown, then the long running process will occur, <b>where to buy Zovirax</b>, <b>Zovirax duration</b>, and lastly the BusyIndicator will be hidden.&#160; To most people’s surprise it doesn’t work.&#160; The BusyIndicator never shows and the UI is not responsive.&#160; Do you see the problem?&#160; The problem is that everything is running on the UI thread.</p>  <h4>Solution</h4>  <p>As we have already stated, the long running process must occur on a separate thread.&#160; The UI thread needs to stay responsive while the process is running.&#160; The most common method to place a long running process on a separate thread is to use the <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">BackgroundWorker</a>.</p>  <p>Let’s modify the event handler to utilize a BackgroundWorker.</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d9f44bc-5752-45ae-9978-3790efb12e11" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax photos</b>, <b>Zovirax dosage</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>taking Zovirax</b>, <b>Doses Zovirax work</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     <span style="color:#008000">//this is where the long running process should go</span><br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#008000">//no direct interaction with the UI is allowed from this method</span><br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 System.Threading.<span style="color:#2b91af">Thread</span>.Sleep(50);<br>             }<br>         };<br>     worker.RunWorkerCompleted += (o, <b>Zovirax price</b>, <b>Zovirax pics</b>, ea) =&gt;<br>         {<br>             <span style="color:#008000">//work has completed. you can now interact with the UI</span><br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };<br>     <span style="color:#008000">//set the IsBusy before you start the thread</span><br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>Examine the code.&#160; First we create an instance of a BackgroundWorker and add delegates for the DoWork and RunWorkerCompleted events.&#160; The DoWork hander is where the long running process should go.&#160; NO DIRECT INTERACTION WITH THE UI IS ALLOWED.&#160; The RunWorkerCompleted handler is code that will run when the long running process has completed.&#160; This is where you can interact with the UI again, <b>generic Zovirax</b>, <b>Where can i cheapest Zovirax online</b>, meaning that this would be a perfect place to set the IsBusy property to False.&#160; After the long running process has finished.&#160; Now pay special attention to where we are calling RunWorkerAsync.&#160; Just before that call, we are setting the IsBusy property to true.&#160; Then the call to RunWorkerAsync is made.&#160; This will show the BusyIndicator and then start the long running process.&#160; When the process is complete the BusyIndicator is hidden again.&#160; Perfect!</p>  <h4>Common Problem 2</h4>  <p>The next common problem is dealing with using data that is generated on the background thread in the UI.&#160; Well if you read my post on <a href="http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/" target="_blank">multi-threading</a> then you should already know how to solve this one.&#160; If you haven’t, <b>online Zovirax without a prescription</b>, <b>Zovirax no rx</b>, I will show you again.&#160; This scenario requires that our UI have a ListBox control that is populated with items on a background thread.&#160; While the items are being populated, the BusyIndicator should show the user something is happening and that they need to be patient.&#160; Let’s modify our UI and our code behind to support his new scenario:</p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:58af4917-346e-44f6-a7ff-44ebb8496123" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax treatment</b>, <b>Buy Zovirax without a prescription</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_busyIndicator&quot; &gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;*&quot; /&gt;</span><br>             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;Auto&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;_listBox&quot; /&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#ff0000"> Grid.Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#ff0000"> Click</span><span style="color:#0000ff">=&quot;StartProcess&quot;&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div> </p>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:72133875-3c6a-4c6e-8851-28028ffb1e1b" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax canada, mexico, india</b>, <b>Zovirax australia, uk, us, usa</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>rx free Zovirax</b>, <b>Buy cheap Zovirax</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br> <br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 100; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>no prescription Zovirax online</b>, <b>Zovirax pharmacy</b>, i));<br>             }<br> <br>             <span style="color:#008000">//BAD MOJO</span><br>             _listBox.ItemsSource = listOfString;<br>             _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>         };            <br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>This is similar to what the problem cases look like.&#160; This code will most definitely fail.&#160; Remember, you cannot access any UI elements on a separate thread.&#160; Now let’s modify this code to make it run correctly.</p>  <h4>Solution</h4>  <p>   <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:503b197c-1e59-4aa3-b765-406528412ef6" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax alternatives</b>, <b>Order Zovirax online c.o.d</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> StartProcess(<span style="color:#0000ff">object</span> sender, <b>buying Zovirax online over the counter</b>, <b>Zovirax from mexico</b>, <span style="color:#2b91af">RoutedEventArgs</span> e)<br> {<br>     <span style="color:#2b91af">BackgroundWorker</span> worker = <span style="color:#0000ff">new</span> <span style="color:#2b91af">BackgroundWorker</span>();<br>     worker.DoWork += (o, ea) =&gt;<br>         {<br>             <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">String</span>&gt; listOfString = <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">string</span>&gt;();<br>             <span style="color:#0000ff">for</span> (<span style="color:#0000ff">int</span> i = 0; i &lt; 10000000; i++)<br>             {<br>                 listOfString.Add(<span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;Item: {0}&quot;</span>, <b>buy Zovirax from canada</b>, <b>Order Zovirax online c.o.d</b>, i));<br>             }<br> <br>             <span style="color:#008000">//use the Dispatcher to delegate the listOfStrings collection back to the UI</span><br>             Dispatcher.Invoke((<span style="color:#2b91af">Action</span>)(() =&gt; _listBox.ItemsSource = listOfString));<br>         };<br>     worker.RunWorkerCompleted += (o, ea) =&gt;<br>     {<br>         _busyIndicator.IsBusy = <span style="color:#0000ff">false</span>;<br>     };<br>     _busyIndicator.IsBusy = <span style="color:#0000ff">true</span>;<br>     worker.RunWorkerAsync();<br> }</div> </div> </div> </p>  <p>First we had to remove any reference to a UI element from the DoWork handler.&#160; Now in order to propagate the generate list of strings back to the ListBox we enlist the help of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx" target="_blank">Dispatcher</a>.&#160; The Dispatcher will take the collection of strings, and in a thread safe way, give them to the ListBox for consumption.&#160; Our BusyIndicator will be shown while the collection is being generated, and then be hidden when the process has been completed.</p>  <p>That about wraps it up.&#160; These are the most common troubles developers have had using the BusyIndicator control.&#160; If you have different problems that you haven’t been able to solve, feel free to post your question in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Discussions</a> page of the project site.&#160; You never know, it may be worth blogging about.</p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4936'>Buy Wellbutrin SR Without Prescription</a>. <a href='http://elegantcode.com/?p=4846'>Buy Ketoconazole Cream Without Prescription</a>. <a href='http://elegantcode.com/?p=5094'>Clomid For Sale</a>. <a href='http://elegantcode.com/?p=4935'>Ordering Aricept online</a>. <a href='http://elegantcode.com/?p=4733'>Discount Aldactone</a>. <a href='http://elegantcode.com/?p=4576'>Where can i buy cheapest Alesse (Ovral L) online</a>. <a href='http://elegantcode.com/?p=4435'>Where can i find Lipitor online</a>. <a href='http://elegantcode.com/?p=4687'>Purchase Ampicillin</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5345'>Zovirax For Sale</a>. <a href='http://linuxologist.com/?p=147'>Zovirax For Sale</a>. <a href='http://blog.farmland.org/?p=3404'>Zovirax For Sale</a>. <a href='http://home.officesnapshots.com/?p=131'>Zovirax For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14216'>Zovirax For Sale</a>. <a href='http://www.thegriffonnews.com/?p=9493'>Herbal Zovirax</a>. <a href='http://www.quarterlives.com/?p=718'>Zovirax dose</a>. <a href='http://www.greatgreengoods.com/?p=2285'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=5249'>Zovirax results</a>. <a href='http://social-blend.com/?p=682'>Buy cheap Zovirax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma For Sale</title>
		<link>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkit-release-1-4-0</link>
		<comments>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:40:15 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/</guid>
		<description><![CDATA[It’s that time again.&#160; Time for another release of the Extended WPF Toolkit Soma For Sale, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the [...]]]></description>
			<content:encoded><![CDATA[<p> <p>It’s that time again.&#160; Time for another release of the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Soma For Sale</b>, .&#160; I know it’s only been three short months since the last release, but this release is packed with 11 new controls as well as many bug fixes and updated controls.&#160; I have been working hard to provide the WPF community with a full set of controls to meet the most common control needs.&#160; So let’s look at the newest members of the Extended WPF Toolkit family.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=Calculator&amp;referringTitle=Home" target="_blank">Calculator</a></h3>  <p>The Calculator is a control used for performing mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculator.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculator" border="0" alt="calculator" src="http://elegantcode.com/wp-content/uploads/2011/04/calculator_thumb.jpg" width="245" height="270" /></a></p>  <p>It provides basic math functions, memory functions, as well as mouse and keyboard support.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=CalculatorUpDown&amp;referringTitle=Documentation" target="_blank">CalculatorUpDown</a></h3>  <p>The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="calculatorupdown" border="0" alt="calculatorupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/calculatorupdown_thumb.jpg" width="198" height="244" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorCanvas&amp;referringTitle=Documentation" target="_blank">ColorCanvas</a></h3>  <p>The ColorCanvas allows you to select a color either using an advanced color canvas, <b>what is Soma</b>, <b>Soma dosage</b>, by setting the HexadecimalString, or by setting the ARGB values.&#160; This control has also been merged with the <a href="http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&amp;referringTitle=Documentation" target="_blank">ColorPicker</a> to provide advanced color editing abilities.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="color_canvas" border="0" alt="color_canvas" src="http://elegantcode.com/wp-content/uploads/2011/04/color_canvas_thumb.jpg" width="257" height="275" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&amp;referringTitle=Documentation" target="_blank">DateTimePicker</a></h3>  <p>Get the best of both worlds, <b>Soma long term</b>.  <b>Buy Soma no prescription</b>, The DateTimePicker provides a DateTimeUpDown control as well as a dropdown with a calendar and a TimePicker.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://elegantcode.com/wp-content/uploads/2011/04/datetimepicker_thumb.jpg" width="308" height="263" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DecimalUpDown&amp;referringTitle=Documentation" target="_blank">DecimalUpDown</a></h3>  <p>The DecimalUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Decimal&gt; values by using the spinner buttons, keyboard up/down arrows, <b>order Soma from mexican pharmacy</b>, <b>Soma mg</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb.jpg" width="524" height="226" /></a></p>  <p>When using the DecimalUpDown in data binding scenarios, bind your object's value to the <b>Value</b> property, <b>Soma maximum dosage</b>.  <b>Buy Soma without a prescription</b>, You can specify how much to increment the value by setting the <b>Increment</b> property. You can control the minimum and maximum allowed values by setting the <b>Minimum</b> and the <b>Maximum</b> properties, <b>online buy Soma without a prescription</b>.  <b>Is Soma safe</b>, You can also specify if the user can directly edit the values in the text box by setting the <b>IsEditable</b> property. If you would like to get the actual fromatted string representation of the value, <b>Soma results</b>, <b>Effects of Soma</b>, you can use the <b>Text</b> property.</p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=DoubleUpDown&amp;referringTitle=Documentation" target="_blank">DoubleUpDown</a></h3>  <p>The DoubleUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;Double&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma forum</b>, <b>Where can i cheapest Soma online</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="decimalupdown" border="0" alt="decimalupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/decimalupdown_thumb1.jpg" width="524" height="226" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=IntegerUpDown&amp;referringTitle=Documentation" target="_blank">IntegerUpDown</a></h3>  <p>The IntegerUpDown control provides a TextBox with button spinners that allow incrementing and decrementing Nullable&lt;int&gt; values by using the spinner buttons, keyboard up/down arrows, <b>Soma from mexico</b>, <b>Soma steet value</b>, or mouse wheel.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="integerupdown" border="0" alt="integerupdown" src="http://elegantcode.com/wp-content/uploads/2011/04/integerupdown_thumb.jpg" width="448" height="236" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid&amp;referringTitle=Documentation" target="_blank">PropertyGrid</a></h3>  <p>The PropertyGrid is a pure WPF replacement for the WinForm PropertyGrid control.&#160; Currently the PropertyGrid is in beta and still has a lot of work to be done on it.&#160; But it is ready from simple use and testing.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="propertygrid" border="0" alt="propertygrid" src="http://elegantcode.com/wp-content/uploads/2011/04/propertygrid_thumb.jpg" width="413" height="762" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=SplitButton&amp;referringTitle=Documentation" target="_blank">SplitButton</a></h3>  <p>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="splitbutton" border="0" alt="splitbutton" src="http://elegantcode.com/wp-content/uploads/2011/04/splitbutton_thumb.jpg" width="496" height="470" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=TimePicker&amp;referringTitle=Documentation" target="_blank">TimePicker</a></h3>  <p>The TimePicker is a control that is specifically for the Time portion of a DateTime property.&#160; It provides a ButtonSpinner as well as a list of times to choose from.&#160; You can also manually type in the time as long as it matches the specified format.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/time_picker.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="time_picker" border="0" alt="time_picker" src="http://elegantcode.com/wp-content/uploads/2011/04/time_picker_thumb.jpg" width="176" height="178" /></a></p>  <h3><a href="http://wpftoolkit.codeplex.com/wikipage?title=WatermarkTextBox&amp;referringTitle=Documentation" target="_blank">WatermarkTextBox</a></h3>  <p>The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, <b>Soma from canada</b>, <b>Purchase Soma online no prescription</b>, usually a String, to represent null or missing text.&#160; Don’t think you are limited to just text!&#160; With this control you may use any object as a watermark.&#160; Here is an example using an image with text:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_image" border="0" alt="watermarktextbox_image" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_image_thumb.jpg" width="230" height="38" /></a></p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watermarktextbox_imagename" border="0" alt="watermarktextbox_imagename" src="http://elegantcode.com/wp-content/uploads/2011/04/watermarktextbox_imagename_thumb.jpg" width="229" height="43" /></a></p>  <p>Also, <b>Soma wiki</b>, <b>Soma from canadian pharmacy</b>, all input controls in the Extended WPF Toolkit now provide a Watermark option.</p>  <p>That’s it for the new controls.&#160; I hope you enjoy version 1.4.0 and be sure to report any bugs or request new features in the <a href="http://wpftoolkit.codeplex.com/workitem/list/basic" target="_blank">Issue Tracker</a>.&#160; As always if you have any questions be sure to ask them in the <a href="http://wpftoolkit.codeplex.com/discussions" target="_blank">Discussions</a>.</p>.  Canada, mexico, india.  Soma natural.  Soma price.  Soma class.  My Soma experience.  Soma pictures.  Online buying Soma.  Cheap Soma no rx.  Buy generic Soma.  Get Soma.  Soma recreational.  Where to buy Soma.  Online buying Soma hcl.  Soma no rx.  Soma without a prescription.  Soma interactions.  Soma for sale.  Online Soma without a prescription.  Soma use.  Soma dangers.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=5165'>Zithromax For Sale</a>. <a href='http://elegantcode.com/?p=4780'>Buy Synthroid Without Prescription</a>. <a href='http://elegantcode.com/?p=4297'>Buy Reglan Without Prescription</a>. <a href='http://elegantcode.com/?p=4843'>Atenolol For Sale</a>. <a href='http://elegantcode.com/?p=4218'>Elavil For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Effects of Abilify</a>. <a href='http://elegantcode.com/?p=4669'>Purchase Ventolin</a>. <a href='http://elegantcode.com/?p=4772'>Real brand Celexa online</a>. <a href='http://elegantcode.com/?p=4673'>Fast shipping Tetracycline</a>. <a href='http://elegantcode.com/?p=4378'>Reglan coupon</a>.<br />
<b>Trackbacks from:</b> <a href='http://4realz.net/?p=1556'>Soma For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=5965'>Soma For Sale</a>. <a href='http://www.greatgreengoods.com/?p=2593'>Soma For Sale</a>. <a href='http://www.thegriffonnews.com/?p=10063'>Soma For Sale</a>. <a href='http://evanrapoport.com/?p=203'>Soma For Sale</a>. <a href='http://social-blend.com/?p=723'>Soma treatment</a>. <a href='http://blog.farmland.org/?p=3616'>Australia, uk, us, usa</a>. <a href='http://reversemortgagedaily.com/?p=13974'>Soma pharmacy</a>. <a href='http://home.officesnapshots.com/?p=334'>Cheap Soma no rx</a>. <a href='http://www.themusclecarplace.com/?p=4596'>Buy generic Soma</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/08/extended-wpf-toolkit-release-1-4-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extend your Master Pages</title>
		<link>http://elegantcode.com/2010/02/18/extend-your-master-pages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extend-your-master-pages</link>
		<comments>http://elegantcode.com/2010/02/18/extend-your-master-pages/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:29:07 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/02/18/extend-your-master-pages/</guid>
		<description><![CDATA[This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go. Lets start things out by outlining [...]]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I’ve been throwing around for a while now, and I have implemented in a couple of project.&#160; The basic idea is to extend the basic master page, by adding more ContentPlaceholders, to give your developers a heads up as to where things should go.</p>  <p>Lets start things out by outlining the various parts of a web page:</p>  <ul>   <li>Title</li>    <li>Header</li>    <li>Content</li>    <li>Footer</li>    <li>CSS includes</li>    <li>Script includes</li>    <li>JavaScript</li> </ul>  <p>Typically, without eliciting some <a href="http://elegantcode.com/2009/11/07/asp-net-mvc-javascriptview/">tricks</a>, there will be some JavaScript in your page, as there will be some part of the script that is dynamic.&#160; But best case, all of the JavaScript that you need can be put into a separate file.&#160; But even then, if we are talking 5 lines of JavaScript I will probably give you a pass if you keep it in the file.</p>  <p>But what I want to do is encourage <strike>best</strike> better practices.&#160; CSS is declared at the top, JavaScript at the bottom, html in the middle, code you want to run right after the page loads here.</p>  <p>So here is a typical MasterPage after I’ve made a few modifications:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="background-color: #ffff00">&lt;%@ Master Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewMasterPage&quot; %&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">&lt;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span> <span style="color: #ff0000">PUBLIC</span> <span style="color: #0000ff">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;TitleContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span> <span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;MainContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="background-color: #ffff00">&lt;%</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> = Html.IncludeScript(<span style="color: #006080">&quot;~/Scripts/jquery-1.3.2.min.js&quot;</span>) </pre><!--CRLF--><span style="background-color: #ffff00">%&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">asp:ContentPlaceHolder</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">=&quot;ScriptIncludesContent&quot;</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">=&quot;server&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">asp:ContentPlaceHolder</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/javascript&quot;</span><span style="color: #0000ff">&gt;</span><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span>&#160; </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     $(document).ready(MasterLoadPage);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">function</span> MasterLoadPage(){</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;asp:ContentPlaceHolder ID=<span style="color: #006080">&quot;DocumentReadyContent&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         &lt;/asp:ContentPlaceHolder&gt;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     </pre><!--CRLF--><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>You can see that I’ve added some extra placeholders in the code there.&#160; </p>

<p>But does any of this suck? Yes.&#160; When you add a page that implements this master page, you will get all of the appropriate content areas, but they will all assume that you are going to add html/text to them.&#160;&#160;&#160; The consequence is that the DocumentReadyContent Content area that is generated cannot help you with any JavaScript/Css intellesense.&#160; </p>

<p>To some extent, that is still ok, as I am looking to minimize the amount of JavaScript and css in my pages…you could say the pain is disserved. :)&#160;&#160; But what would be nice is if we could add a language indicator to the Content element. (hint: Microsoft VS team, I’m looking at you).&#160;&#160; </p>

<p>If you also think adding language indicators would be cool, vote here: <a href="http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-">http://aspnet.uservoice.com/forums/41199-general/suggestions/487773-make-language-specific-contentplaceholders-</a></p>

<p>Happy hacking.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/02/18/extend-your-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Non-Public Methods</title>
		<link>http://elegantcode.com/2010/01/28/calling-non-public-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calling-non-public-methods</link>
		<comments>http://elegantcode.com/2010/01/28/calling-non-public-methods/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:47:39 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/28/calling-non-public-methods/</guid>
		<description><![CDATA[A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal [...]]]></description>
			<content:encoded><![CDATA[<p>A typical way for invoking a non-public method of a class is by using reflection. This can come in handy in a number of cases. One typical scenario that comes to mind is when the designers of the .NET Framework or another 3rd party framework decided to bury a class or a method as internal while this could perfectly solve a problem (I just hate it when they do that).</p>  <p>Invoking private methods is not considered a best practice in general, but there are cases where you have no other option than to fall back on using reflection. The following code snippet shows how one would typically accomplish that.</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Subject
{
    <span class="kwrd">private</span> String DoSomething(String input)
    {
        <span class="kwrd">return</span> input;
    }
}

<span class="rem">// Calling code</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = <span class="kwrd">typeof</span>(Subject).GetMethod(<span class="str">&quot;DoSomething&quot;</span>, 
    BindingFlags.Instance | BindingFlags.NonPublic);
var result = doSomething.Invoke(subject, <span class="kwrd">new</span>[] { <span class="str">&quot;Hello Muppets&quot;</span> });
Console.WriteLine(result);  </pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>We all recognize this piece of code as we’ve done this at some point in one of our coding sessions. What I want to share here is a slightly nicer way to accomplish the same without all the usual reflection ugliness.</p>

<pre class="csharpcode"><span class="rem">// Calling code that uses delegates</span>
var subject = <span class="kwrd">new</span> Subject();
var doSomething = (Func&lt;String, String&gt;)
    Delegate.CreateDelegate(<span class="kwrd">typeof</span>(Func&lt;String, String&gt;), subject, <span class="str">&quot;DoSomething&quot;</span>);
Console.WriteLine(doSomething(<span class="str">&quot;Hello Freggles&quot;</span>));</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>This code just creates a delegate that matches the signature of the non-public method that we want to call. To me, this approach looks far more elegant. Note that this only works for instance methods and not for static methods. </p>

<p>I hope that this can be of some use.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/28/calling-non-public-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>State Pattern, Enumeration Class and Fluent NHibernate (Oh my!)</title>
		<link>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-pattern-enumeration-class-and-fluent-nhibernate-oh-my</link>
		<comments>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:20:10 +0000</pubDate>
		<dc:creator>Richard Cirerol</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Fluent NHibernate;State Pattern;Enumeration]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/</guid>
		<description><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.]]></description>
			<content:encoded><![CDATA[Recently, I needed to change a basic enumeration into a full-fledged state pattern. After getting all my domain classes updated, I began reviewing the persistence layer. And I hit a wall.  I wasn’t sure how I wanted to update my Fluent NHibernate convention to persist the current state.

My original classes were similar to this:
<pre class="brush: csharp;">public class MyProgress{ 
   public virtual Guid Id { get; set; }
   ...
   ... 
   public virtual MyStatus Status { get; private set; }
}

public enum MyStatus{ 
   New, 
   InProgress, 
   Completed, 
   Canceled, 
   Failed
}
</pre>
My new state pattern was similar to this:
<pre class="brush: csharp;">
public abstract class MyStatus
{
    public static readonly MyStatus New = new NewStatus();
    public static readonly MyStatus InProgress = new InProgressStatus();
    ...
}

public class NewStatus: MyStatus
{
    public override void Start(MyProgress progress)
    {
        progress.SetStatus(InProgress);
    }
    public override void Cancel(MyProgress progress)
    {
        progress.SetStatus(Cancelled);
    }
    public override void Fail(MyProgress progress)
    {
            progress.SetStatus(Failed);
    }
}
...
</pre>
Here is the problem… My enumeration was persisted as an integer field on the record. Now that I had a state pattern, how should I save my state? I googled the problem and found <a href="http://www.lostechies.com/blogs/derickbailey/archive/2008/11/26/mapping-a-state-pattern-with-nhibernate.aspx" target="_blank">Derick Bailey’s article</a> on the state pattern and Fluent NHibernate. Derick’s pattern works well, but I felt that creating a lookup table in my database just so I can persist a value in another table was not the path I wanted to traverse – I wasn’t persisting an entity, I was persisting a state value on an entity. Not finding any more love from Google, I asked around and was advised to contact fellow Elegant Coder and <a href="http://guild3.com" target="_blank">Guild3</a> member, <a href="http://elegantcode.com/author/jgrundy/" target="_blank">Jason Grundy</a>. Here is Jason’s advice:
<blockquote>"I've recently changed from using Enums to an approach outlined by Jimmy Bogard <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/08/12/enumeration-classes.aspx">here</a>.  In the Entity I would do something like this:
<pre class="brush: csharp;">
protected int _orderStatusId;
public virtual OrderStatus OrderStatus
{
    get { return Enumeration.FromValue&lt;OrderStatus&gt;(_orderStatusId); }
    set { _orderStatusId = value.Value; }
}
</pre>
Then in Fluent NH you can simply map to the protected member."</blockquote>
I decided to pursue Jason’s advice.  The result is my database tables did not need to change at all. Here is some snippets of the updated classes:
<pre class="brush: csharp;">
public class MyProgress
{
     public virtual Guid Id {get;set;}
     ...
     protected int _status;
     public virtual MyStatus
     {
         get{ return Enumeration.FromValue&lt;MyStatus&gt;(_status); }
         set{ _status = value.Value; }
     }
     ...
}
 
public class MyStatus : Enumeration
{
     public static MyStatus New = new NewStatus();
     ...
 
     private class NewStatus : MyStatus
    {
         public NewStatus() : base (0,"New"){}

         public override void Start(MyProgress progress)
         {
             progress.SetStatus(InProgress);
         }
    }
     ...
</pre>
Notice that the MyStatus class is no longer abstract.  However, the subclasses are all private nested classes, each with a value and a display name.  I set each subclass value to match the enumeration value it replaced.  I did not need to convert my existing data to a new schema.

And here is the Fluent NHibernate override:
<pre class="brush: csharp;">
public class MyProgressOverride : IAutoMappingOverride&lt;MyProgress&gt;
{
    public void Override(AutoMapping&lt;MyProgress&gt; mapping)   
    {
        mapping.Map(x =&gt; x.Status)
            .CustomType(typeof(int))
            .Access.CamelCaseField(Prefix.Underscore);
    }
}
</pre>
As you can see, we use convention-based automapping with overrides, but this same map could be used in a standard class map.

Thanks to Jimmy, Derick, and Jason for the inspiration and assistance!

<script type="text/javascript"> 
var cirerolGaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + cirerolGaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script> 
<script type="text/javascript"> 
var cirerolPageTracker = _gat._getTracker('UA-8257866-3');
cirerolPageTracker._initData();
cirerolPageTracker._trackPageview();
</script>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/01/state-pattern-enumeration-class-and-fluent-nhibernate-oh-my/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Extending the ObservableCollection to add navigation methods such as MoveFirst, MoveNext, MoveLast, and MovePrevious.</title>
		<link>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious</link>
		<comments>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:33:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[observablecollection items navigation]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/</guid>
		<description><![CDATA[Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list. Enter the ICollectionView.&#160; “You can think of a collection view as a layer on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had the need to navigate a list by using methods such as MoveFirts, MovePrevious, MoveNext, and MoveLast while at the same time keeping track of its current location to notify the user where they are at in the list.</p>  <p>Enter the ICollectionView.&#160; “You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.”, says the MSDN documentation. The ICollectionView supports filtering, sorting, grouping, selection, and navigation.</p>  <p>Now the most common way this is used is by creating your collection, populating it with data, then creating an ICollectionView instance from your collection, and then start sorting, filtering, grouping, etc.&#160; The following code show some examples of how to use the ICollectionView.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//get the view</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;MyObject&gt; myList = <span style="color: #0000ff">new</span> List&lt;MyObject&gt;();   </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICollectionView view = CollectionViewSource.GetDefaultView(myList);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//filtering</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.Filter = <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> item)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{<span style="color: #0000ff">return</span> item.Contains(searchText);};</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//sorting</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.SortDescriptions.Add(<span style="color: #0000ff">new</span> SortDescription(<span style="color: #006080">&quot;LastName&quot;</span>, direction));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//grouping</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.GroupDescriptions.Add(<span style="color: #0000ff">new</span> PropertyGroupDescription(<span style="color: #006080">&quot;State&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">//selection</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">view.CurrentItem</pre>
  </div>
</div>

<p>But I didn’t want to do this every time I had a collection of data I wanted to navigate. I wanted a single generic collection class that encapsulated all this functionality. So I decided to extend the ObservableCollection to allow for this functionality. So the first thing I need to do is create my class, inherit from ObservableCollection, and then create my constructors.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(List&lt;T&gt; list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(list)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> MyObservableCollection(IEnumerable&lt;T&gt; collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        : <span style="color: #0000ff">base</span>(collection)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Next I want to create my method to return my instance of ICollectionView.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> System.ComponentModel.ICollectionView GetDefaultView()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> System.Windows.Data.CollectionViewSource.GetDefaultView(<span style="color: #0000ff">this</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets create a property to retrieve the currently selected item in the list.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> CurrentPosition</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    get</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> GetDefaultView().CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now lets create our four methods for navigating the items in the collection.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveFirst()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToFirst();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MovePrevious()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToPrevious();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveNext()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> MoveLast()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    GetDefaultView().MoveCurrentToLast();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, lets use our new collection. First start off by creating and instance of your custom collection. </p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 30px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">MyObservableCollection&lt;MyObject&gt; ProgressItemsList = <br /><span style="color: #0000ff">new</span> MyObservableCollection&lt;MyObject&gt;(data);</pre>
</div>

<p>In this example I am using a WPF Ribbon to hold my navigation controls, and commanding to execute the navigation methods. The center label maintains the current position and the count of the number of items in the collection.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ribbon_navigation" border="0" alt="ribbon_navigation" src="http://elegantcode.com/wp-content/uploads/2009/09/ribbon_navigation_thumb.jpg" width="231" height="99" /></a></p>

<p>So now, when I click the Next button I first need to check whether or not I can move to the next record in the command’s CanExecute event.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> CanMoveNext(<span style="color: #0000ff">object</span> parameter)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">bool</span> canExecute = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (ProgressItemsList != <span style="color: #0000ff">null</span>)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> currentPosition = ProgressItemsList.CurrentPosition;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">int</span> lastIndex = ProgressItemsList.Count - 1;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        canExecute = currentPosition &lt; lastIndex;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> canExecute;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>If I can move to the next record, then execute the Execute method of the command.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> MoveNext(<span style="color: #0000ff">object</span> sender)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ProgressItemsList.MoveNext();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>That is it, and because this is an ObservableCollection, all the changes are notified back to the UI for you automatically. Now you can extend your custom collection even more to customize your sorting, filtering and grouping.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/25/extending-the-observablecollection-to-add-navigation-methods-such-as-movefirst-movenext-movelast-and-moveprevious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please, it is just a &#8216;var&#8217;</title>
		<link>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=please-it-is-just-a-var</link>
		<comments>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 03:33:22 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/08/25/please-it-is-just-a-var/</guid>
		<description><![CDATA[OK, on a previous post I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, [...]]]></description>
			<content:encoded><![CDATA[<p>OK, on a <a href="http://elegantcode.com/2009/08/14/observations-on-the-if-statement/">previous post</a> I had a little bit of code with a ‘var’ statement in it.&#160; Actually, there were a few other items in there, couple of lambdas, lots of nested ‘if’s, etc.&#160;&#160; There was a lot of good hand wrangling on how performant the Lambda ‘Where’ function is.&#160; According to the comments, not very performant for very large datasets.&#160; I don’t have a problem with that.</p>  <p>But at some point one of the commentors noticed that the var statement was just as fast as the explicitly called out type.&#160; Let me spell something out real quick: <strong>Once compiled, there is no difference between var and explicit types.</strong>&#160; ‘var’ is a language sort-cut, asking the <strong>compiler</strong> to figure out the type and inject it.&#160; This is not a runtime feature – ‘var’ is a compile time feature.</p>  <p>Now, how often do I use var in my code?&#160; All the time.&#160; I use it practically everywhere.&#160; Think of it as a refactoring helper.&#160; Sometime I have to change a method from returning a IList to an IEnumerable.&#160; If I use a var and a foreach then none of the rest of my code has to change.&#160; That, to me is flexible code.</p>  <p>I could make my code more performant by replacing the foreach loops with for loops – but I’ll keep the var’s thank-you-very-much.&#160; But most of the time I am not dealing with enough data to make that worth it.&#160; Most of the time I’m working with data to get displayed on web and mobile user interfaces.&#160; In those cases, limiting the amount of data I need to process, and then display, is of upmost importance.&#160; If I’m doing a file import (rare, but it does happen), then I switch to the other techniques.</p>  <p>Now, why bother?&#160; Why not always use the fastest method all the time?&#160; Because I find the foreach with ‘var’s easier to read, more flexable code, and more refactoring friendly.&#160; For the vast majority of my code, that matters a lot more than eking out every last bit of performance.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/08/25/please-it-is-just-a-var/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Exception Logging with EntLib Made Simple</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF Multithreading: Using the BackgroundWorker and Reporting the Progress to the UI.</title>
		<link>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exception-logging-with-entlib-made-simple</link>
		<comments>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 06:06:15 +0000</pubDate>
		<dc:creator>David Starr</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/</guid>
		<description><![CDATA[Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. Also, it is something that needs to be done. So, can we make exception logging as frictionless as possible? Roll your own logging library. Repeat the same code a lot in your application [...]]]></description>
			<content:encoded><![CDATA[<p>Logging application exceptions is like getting a new muffler. It isn’t exciting. It isn’t very fulfilling. It just costs time and money. </p>  <p>Also, it is something that needs to be done.</p>  <p>So, can we make exception logging as frictionless as possible?</p>  <ol>   <li>Roll your own logging library.</li>    <li>Repeat the same code a lot in your application calling your library.</li> </ol>  <p>Kidding. On both fronts.</p>  <h2>Extending Exception</h2>  <p>Since the problem is just about logging exceptions, adding an extension method to the basic Exception class makes a lot of sense.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     . . . </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, using this extension method, logging an exception looks like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">try</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #008000">// do something that would throw</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">// an exception</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     ex.Log();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--CRLF--></div>
</div>

<p>&#160;</p>

<p></p>

<h2>Enterprise Library Logging Application Block</h2>

<p>Enterprise Library makes what happens inside the extension method an easy implementation, too. The act of logging is simple enough with EntLib, but the real value is in how the configuration story lets an application administrator decide how the logging solution will actually behave at runtime.</p>

<p>For instance, when building a recent application, I asked the client if they wanted to receive email when a significant application error occurred. Their response was, “Just write to the Windows Event log. We have a monitoring application that will email us.”</p>

<p>Fine by me! Windows Event log, text file, email, it’s all the same because the ultimate destination of the log message is a configuration setting.</p>

<p>Anyway, the implementation of the extension method can look as simple as this.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Log( <span style="color: #0000ff">this</span> Exception exception )</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     var entry = <span style="color: #0000ff">new</span> LogEntry</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         Severity = TraceEventType.Warning,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         Title = <span style="color: #006080">&quot;Application Exception&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         Message = exception.ToString(),</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     };</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     Logger.Write(entry);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Of course, I ended up with some overloads and other niceties , but the basic approach remains sound. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/07/31/exception-logging-with-entlib-made-simple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; .Net 3.5</title>
	<atom:link href="http://elegantcode.com/category/net-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +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>Buy Diclofenac Without Prescription</title>
		<link>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitthe-updated-propertygrid</link>
		<comments>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:26:07 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>
		<category><![CDATA[propertygrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/</guid>
		<description><![CDATA[The PropertyGrid control in the Extended WPF Toolkit Buy Diclofenac Without Prescription, was released in version 1.4.0 as beta. Buy Diclofenac without a prescription, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta. Well it is beta no more, buy cheap Diclofenac. Diclofenac gel, ointment, cream, [...]]]></description>
			<content:encoded><![CDATA[<p> <div>The PropertyGrid control in the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> <b>Buy Diclofenac Without Prescription</b>, was released in version 1.4.0 as beta.  <b>Buy Diclofenac without a prescription</b>, Since then I have had another release of version 1.5.0 in which the PropertyGrid was still in beta.  Well it is beta no more, <b>buy cheap Diclofenac</b>.  <b>Diclofenac gel, ointment, cream, pill, spray, continuous-release, extended-release</b>, I have given the PropertyGrid a lot of love an affection over the past few weeks and it is finally ready for prime time.  Unfortunately, <b>Diclofenac samples</b>, <b>Buy Diclofenac online no prescription</b>, you will have to wait until the release of version 1.6.0 to get an official version.  Luckily for you, the source code is available for you to download and compile to get the latest and greatest PropertyGrid features, <b>Buy Diclofenac Without Prescription</b>.  So what can you do with the PropertyGrid, <b>buying Diclofenac online over the counter</b>.  <b>Diclofenac dosage</b>, Let’s look at some of the notable new and improved features.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid.jpg"><img title="propertygrid" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/propertygrid_thumb.jpg" border="0" alt="propertygrid" width="406" height="743" /></a></div><br />
<div>Of course the PropertyGrid has the expected behavior of binding to an object instance and showing all the properties for your editing desires.  It allows you sort display properties by category or alphabetically, <b>low dose Diclofenac</b>.  <b>Buy Diclofenac online cod</b>, It also provides a nice little search textbox so you can find exactly what you are looking for.</div><br />
<h4>Specifying Properties</h4><br />
<div>By default the PropertyGrid will autogenerate all the properties for a given object.  <b>Buy Diclofenac Without Prescription</b>, Never fear, you can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties.jpg"><img title="specifyingproperties" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/specifyingproperties_thumb.jpg" border="0" alt="specifyingproperties" width="473" height="235" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cff8cdfc-2e9a-49b5-941a-ae3cf5e51557" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span><span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"</span><br />
<span style="color: #ff0000;"> AutoGenerateProperties</span><span style="color: #0000ff;">="False"&gt;</span><br />
<span style="color: #008000;">&lt;!-- Only the following properties will be displayed in the PropertyGrid --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FirstName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="FavoriteColor" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="PetNames" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.PropertyDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div></div><br />
<h4>Custom Editors</h4><br />
<div>By default the PropertyGrid comes with 14 built-in editors:</div><br />
<ul><br />
	<li>CheckBoxEditor</li><br />
	<li>CollectionEditor</li><br />
	<li>ColorEditor</li><br />
	<li>DateTimeUpDownEditor</li><br />
	<li>DecimalUpDownEditor</li><br />
	<li>DoubleUpDownEditor</li><br />
	<li>EnumComboBoxEditor</li><br />
	<li>FontComboBoxEditor</li><br />
	<li>IntegerUpDownEditor</li><br />
	<li>ItemsSourceEditor</li><br />
	<li>PrimitiveTypeCollectionEditor</li><br />
	<li>TextBlockEditor</li><br />
	<li>TextBoxEditor</li><br />
	<li>TimeSpanEditor</li><br />
</ul><br />
<div>These editors don’t meet your needs. No problem, <b>online buying Diclofenac hcl</b>.  <b>Diclofenac without prescription</b>, You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, <b>australia, uk, us, usa</b>, <b>Japan, craiglist, ebay, overseas, paypal</b>, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate, <b>rx free Diclofenac</b>.  <b>Real brand Diclofenac online</b>, Be sure to bind your custom editor to the bound property item's Value property.</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:340c1fd1-6067-4bf0-8add-ca2af36e45b1" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>Diclofenac forum</b>, <b>Diclofenac online cod</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_propertyGrid1"</span><span style="color: #ff0000;"> Width</span><span style="color: #0000ff;">="450"</span> <span style="color: #ff0000;"> Margin</span><span style="color: #0000ff;">="10"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor, <b>taking Diclofenac</b>. --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> HorizontalAlignment}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Green"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><span style="color: #a31515;"> </span><span style="color: #008000;">&lt;!-- Always bind your editor's value to the bound property's Value --&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor, <b>Buy Diclofenac Without Prescription</b>.  <b>After Diclofenac</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Age" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="WritingFont" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="Spouse" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBlock</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Yellow"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #008000;">&lt;!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor, <b>buy cheap Diclofenac no rx</b>.  <b>Diclofenac canada, mexico, india</b>, --&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #ff0000;"> TargetType</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">x</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">Type</span><span style="color: #ff0000;"> sys</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Boolean}</span><span style="color: #0000ff;">"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="DateOfBirth" /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyDefinition</span><span style="color: #ff0000;"> Name</span><span style="color: #0000ff;">="LastName" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.PropertiesDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="Red"</span> <span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value}</span><span style="color: #0000ff;">" /&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">DataTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition.EditorTemplate</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">EditorDefinition</span><span style="color: #0000ff;">&gt;</span></p>
<p><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid.EditorDefinitions</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">extToolkit</span><span style="color: #0000ff;">:</span><span style="color: #a31515;">PropertyGrid</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div>Don’t like DataTemplates. No problem, <b>Diclofenac steet value</b>.  <b>Diclofenac from canadian pharmacy</b>, You can supply editors for a property by using the System.ComponentModel.EditorAttribute.  <b>Buy Diclofenac Without Prescription</b>, In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes.jpg"><img title="customeditor_attributes" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/customeditor_attributes_thumb.jpg" border="0" alt="customeditor_attributes" width="477" height="240" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c7572a68-6bf0-43ba-b987-a87ed9136b14" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>ordering Diclofenac online</b>, <b>Doses Diclofenac work</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a Class that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>), <b>about Diclofenac</b>, <b>Buy Diclofenac no prescription</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FirstNameEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Last Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #008000;">//This custom editor is a UserControl that implements the ITypeEditor interface</span><br />
[<span style="color: #2b91af;">Editor</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> LastName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div>Your editors can be created as a class:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d2a30fc6-c092-478a-a85c-4ab12fd32646" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac interactions</b>, <b>Diclofenac brand name</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #008000;">//Custom editors that are used as attributes MUST implement the ITypeEditor interface.</span><br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FirstNameEditor</span> : Microsoft.Windows.Controls.PropertyGrid.Editors.<span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">TextBox</span> textBox = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">TextBox</span>();<br />
textBox.Background = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">SolidColorBrush</span>(<span style="color: #2b91af;">Colors</span>.Red);</div><br />
<div><span style="color: #008000;">//create the binding from the bound property item to the editor</span><br />
<span style="color: #0000ff;">var</span> _binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>); <span style="color: #008000;">//bind to the Value property of the PropertyItem</span><br />
_binding.Source = propertyItem;<br />
_binding.ValidatesOnExceptions = <span style="color: #0000ff;">true</span>;<br />
_binding.ValidatesOnDataErrors = <span style="color: #0000ff;">true</span>;<br />
_binding.Mode = propertyItem.IsReadOnly, <b>online Diclofenac without a prescription</b>.  <b>Diclofenac canada, mexico, india</b>, <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(textBox, <span style="color: #2b91af;">TextBox</span>.TextProperty, <b>Diclofenac dose</b>, <b>Buy Diclofenac from canada</b>, _binding);<br />
<span style="color: #0000ff;">return</span> textBox;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<div>Or as a complex UserControl:</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e4302b-e2a0-4137-a11f-9f7c7992f92d" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, <b>get Diclofenac</b>, <b>Diclofenac blogs</b>, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">UserControl</span><span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Class</span><span style="color: #0000ff;">="Samples.Modules.PropertyGrid.LastNameUserControlEditor"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span><br />
<span style="color: #ff0000;"> xmlns</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span><br />
<span style="color: #ff0000;"> x</span><span style="color: #0000ff;">:</span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">="_uc"&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TextBox</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="{</span><span style="color: #a31515;">Binding</span><span style="color: #ff0000;"> Value</span><span style="color: #0000ff;">,</span><span style="color: #ff0000;"> ElementName</span><span style="color: #0000ff;">=</span>_<span style="color: #0000ff;">uc}"</span><span style="color: #ff0000;"> Background</span><span style="color: #0000ff;">="YellowGreen"</span> <span style="color: #0000ff;"> /&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Button</span><span style="color: #ff0000;"> Click</span><span style="color: #0000ff;">="Button_Click"&gt;</span><span style="color: #a31515;">Clear</span><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Button</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">StackPanel</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">UserControl</span><span style="color: #0000ff;">&gt;</span></div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c44d7199-8bac-4ad2-8a36-8ae2698395d6" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Diclofenac maximum dosage</b>, <b>My Diclofenac experience</b>, Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">partial</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">LastNameUserControlEditor</span> : <span style="color: #2b91af;">UserControl</span>, <b>Diclofenac mg</b>, <b>Diclofenac wiki</b>, <span style="color: #2b91af;">ITypeEditor</span><br />
{<br />
<span style="color: #0000ff;">public</span> LastNameUserControlEditor()<br />
{<br />
InitializeComponent();<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ValueProperty = <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"Value"</span>, <span style="color: #0000ff;">typeof</span>(<span style="color: #0000ff;">string</span>), <b>online buying Diclofenac</b>, <span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">LastNameUserControlEditor</span>), <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: #0000ff;">null</span>, <span style="color: #2b91af;">FrameworkPropertyMetadataOptions</span>.BindsTwoWayByDefault));<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> Value<br />
{<br />
<span style="color: #0000ff;">get</span> { <span style="color: #0000ff;">return</span> (<span style="color: #0000ff;">string</span>)GetValue(ValueProperty); }<br />
<span style="color: #0000ff;">set</span> { SetValue(ValueProperty, <span style="color: #0000ff;">value</span>); }<br />
}</div><br />
<div><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> Button_Click(<span style="color: #0000ff;">object</span> sender, <span style="color: #2b91af;">RoutedEventArgs</span> e)<br />
{<br />
Value = <span style="color: #0000ff;">string</span>.Empty;<br />
}</div><br />
<div><span style="color: #0000ff;">public</span> <span style="color: #2b91af;">FrameworkElement</span> ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.<span style="color: #2b91af;">PropertyItem</span> propertyItem)<br />
{<br />
<span style="color: #2b91af;">Binding</span> binding = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">Binding</span>(<span style="color: #a31515;">"Value"</span>);<br />
binding.Source = propertyItem;<br />
binding.Mode = propertyItem.IsReadOnly . <span style="color: #2b91af;">BindingMode</span>.OneWay : <span style="color: #2b91af;">BindingMode</span>.TwoWay;<br />
<span style="color: #2b91af;">BindingOperations</span>.SetBinding(<span style="color: #0000ff;">this</span>, <span style="color: #2b91af;">LastNameUserControlEditor</span>.ValueProperty, binding);<br />
<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Custom ItemsSource</h4><br />
<div>Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by creating a class that implements the IItemsSource interface and decorating your property with the ItemsSourceAttribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource.jpg"><img title="custom_itemssource" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/custom_itemssource_thumb.jpg" border="0" alt="custom_itemssource" width="473" height="484" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fbac7ce0-9aa0-4d3c-aafc-2e5e0cef1807" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Writing"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"Writing Font Size"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses the DoubleUpDown as the default editor."</span>)]<br />
[<span style="color: #2b91af;">ItemsSource</span>(<span style="color: #0000ff;">typeof</span>(<span style="color: #2b91af;">FontSizeItemsSource</span>))]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> WritingFontSize { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e1b0d1f8-7fbf-4976-a1ff-8f5476b08197" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">FontSizeItemsSource</span> : <span style="color: #2b91af;">IItemsSource</span><br />
{<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">IList</span>&lt;<span style="color: #0000ff;">object</span>&gt; GetValues()<br />
{<br />
<span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt; sizes = <span style="color: #0000ff;">new</span> <span style="color: #2b91af;">List</span>&lt;<span style="color: #0000ff;">object</span>&gt;()<br />
{<br />
5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,12.0,14.0,16.0,18.0,20.0<br />
};<br />
<span style="color: #0000ff;">return</span> sizes;<br />
}<br />
}</div><br />
</div><br />
</div><br />
<h4>Expandable Properties</h4><br />
<div>Wait a minute… I’m not done yet.  Do you have a property of a complex object that you want to expand in the PropertyGrid, <b>Buy Diclofenac Without Prescription</b>.  You do.  Well then you want to pay attention to this.  The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute.</div><br />
<div><a href="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject.jpg"><img title="expandableobject" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://elegantcode.com/wp-content/uploads/2011/10/expandableobject_thumb.jpg" border="0" alt="expandableobject" width="469" height="408" /></a></div><br />
<div style="margin: 0px; display: inline; float: none; padding: 0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c46852fa-1754-49c2-9715-3126bdd93d38" class="wlWriterEditableSmartContent"><br />
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;"><br />
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Person</span><br />
{<br />
[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Information"</span>)]<br />
[<span style="color: #2b91af;">DisplayName</span>(<span style="color: #a31515;">"First Name"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property uses a TextBox as the default editor."</span>)]<br />
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> FirstName { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</div><br />
<div>[<span style="color: #2b91af;">Category</span>(<span style="color: #a31515;">"Conections"</span>)]<br />
[<span style="color: #2b91af;">Description</span>(<span style="color: #a31515;">"This property is a complex property and has no default editor."</span>)]<br />
[<span style="color: #2b91af;">ExpandableObject</span>]<br />
<span style="color: #0000ff;">public</span> <span style="color: #2b91af;">Person</span> Spouse { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }<br />
}</div><br />
</div><br />
</div><br />
<h4>Conclusion</h4><br />
<div>As you can see, I have put a lot of time and effort into this control to make it as feature rich and flexible as possible.  This WPF PropertyGrid is freely available in the Extended WPF Toolkit.  All I ask, is that if you use the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>, can you please rate the project and leave feedback with your impressions.  It is always nice to receive feedback to know if my efforts are paying off. Enjoy!</div>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4683'>Inderal For Sale</a>. <a href='http://elegantcode.com/?p=4700'>Buy Inderal Without Prescription</a>. <a href='http://elegantcode.com/?p=4786'>Ultram For Sale</a>. <a href='http://elegantcode.com/?p=5167'>Buy Amoxicillin Without Prescription</a>. <a href='http://elegantcode.com/?p=4195'>Amikacin For Sale</a>. <a href='http://elegantcode.com/?p=4411'>Prednisolone no rx</a>. <a href='http://elegantcode.com/?p=4745'>Advair for sale</a>. <a href='http://elegantcode.com/?p=4482'>Clonidine description</a>. <a href='http://elegantcode.com/?p=4173'>Epogen natural</a>. <a href='http://elegantcode.com/?p=4509'>Slimex (Obetrim) trusted pharmacy reviews</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.macneilbmx.com/blog/?p=6204'>Buy Diclofenac Without Prescription</a>. <a href='http://www.greatgreengoods.com/?p=2900'>Buy Diclofenac Without Prescription</a>. <a href='http://www.thegriffonnews.com/?p=9216'>Buy Diclofenac Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=3076'>Buy Diclofenac Without Prescription</a>. <a href='http://blog.farmland.org/?p=3783'>Buy Diclofenac Without Prescription</a>. <a href='http://www.quarterlives.com/?p=644'>Diclofenac treatment</a>. <a href='http://social-blend.com/?p=915'>Diclofenac dose</a>. <a href='http://www.leaduganda.org/?p=3446'>Australia, uk, us, usa</a>. <a href='http://4realz.net/?p=980'>Is Diclofenac safe</a>. <a href='http://reversemortgagedaily.com/?p=14019'>Buy Diclofenac without a prescription</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/10/21/extended-wpf-toolkitthe-updated-propertygrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zovirax For Sale</title>
		<link>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-wpf-toolkitusing-the-busyindicator</link>
		<comments>http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:40:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[busy indicator]]></category>
		<category><![CDATA[extended wpf toolkit]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/10/07/extended-wpf-toolkitusing-the-busyindicator/</guid>
		<description><![CDATA[Zovirax For Sale, As you may know, I am the author of a WPF control suite call the Extended WPF Toolkit.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the BusyIndicator control.&#160; The majority of questions deal [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Zovirax For Sale</b>, As you may know, I am the author of a WPF control suite call the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a>.&#160; I also spend tons of time on various forums helping people solve problems with their WPF applications.&#160; Lately there have been a number of questions regarding the <a href="http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator&amp;referringTitle=Home" target="_blank">BusyIndicator</a> control.&#160; The majority of questions deal with using it in a multi-threaded environment.&#160; So I thought the best way to address the masses is to write up a post demonstrating the proper use of the BusyIndicator control.</p>  <p>Let’s begin by defining what the BusyIndicator is used for.&#160; The BusyIndicator is used to give an application user a visual indicator that a long running process is occurring.&#160; So from this definition we can make two assumptions. One; There must be a mechanism for notifying the BusyIndicator when the long running process begins and when it ends.&#160; Two; the long running process will have to occur on a separate thread as to not block the UI.</p>  <h4>Anatomy of the BusyIndicator</h4>  <p>The first thing you need to do when using any control inside the Extended WPF Toolkit is add a namespace declaration to the consuming view.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5924be3e-3c95-4be6-92ff-c462f833cac5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax results</b>, <b>Purchase Zovirax for sale</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Window</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Class</span><span style="color:#0000ff">=&quot;BusyIndicatorDemo.MainWindow&quot;</span><br>        <span style="color:#ff0000"> xmlns</span><span style="color:#0000ff">:</span><span style="color:#ff0000">extToolkit</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended&quot;</span><br>        <span style="color:#0000ff"> ...</span></div> </div> </div>  <p>The BusyIndicator is a ContentControl.&#160; What this means is that the BusyIndicator can contain a single child element within it’s open and closing tags.&#160; For example:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:596ca3ad-889f-4541-8855-2e7c1ffb4d33" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', <b>Zovirax from mexico</b>, <b>Zovirax description</b>, Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br>         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><span style="color:#a31515">Start Process</span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Button</span><span style="color:#0000ff">&gt;</span><br>     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;</span><br> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">extToolkit</span><span style="color:#0000ff">:</span><span style="color:#a31515">BusyIndicator</span><span style="color:#0000ff">&gt;</span></div> </div> </div>  <p>Looking at this code snippet you can see that the Grid is the BusyIndicator’s Content.&#160; If you were to place anything outside of this Grid element you would receive an exception.</p>  <p>The BusyIndicator has two visual states:</p>  <p><strong>Not Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="228" /></a></p>  <p><strong>Busy</strong>:</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="ima
