<?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>.Net 4 Fun &#187; Windows Presentation Foundation</title>
	<atom:link href="http://blog.2moveit.de/index.php/category/coding/wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.2moveit.de</link>
	<description></description>
	<lastBuildDate>Thu, 02 Dec 2010 00:21:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Binding a Dictionary to  a ComboBox</title>
		<link>http://blog.2moveit.de/index.php/2010/06/binding-a-dictionary-to-a-combobox/</link>
		<comments>http://blog.2moveit.de/index.php/2010/06/binding-a-dictionary-to-a-combobox/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 06:27:49 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Windows Presentation Foundation]]></category>
		<category><![CDATA[ComboBox]]></category>
		<category><![CDATA[DataBinding]]></category>
		<category><![CDATA[Dictionary]]></category>
		<category><![CDATA[Snippet]]></category>

		<guid isPermaLink="false">http://blog.2moveit.de/?p=278</guid>
		<description><![CDATA[View code (XAML): &#60;ComboBox ItemsSource=&#34;{Binding Items}&#34; DisplayMemberPath=&#34;Value&#34; SelectedValuePath=&#34;Key&#34; SelectedValue=&#34;{Binding SelectedItemCode}&#34;/&#62; ViewModel code: // Key = ItemCode, Value = Name public IDictionary&#60;string, string&#62; Items{get; private set;} public string SelectedItemCode { get { return Settings.Default.SelectedItemCode; } set { if (Settings.Default.SelectedItemCode != value) &#8230; <a href="http://blog.2moveit.de/index.php/2010/06/binding-a-dictionary-to-a-combobox/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>View code (XAML):</p>
<pre class="brush: xml;">&lt;ComboBox ItemsSource=&quot;{Binding Items}&quot;
  DisplayMemberPath=&quot;Value&quot;
  SelectedValuePath=&quot;Key&quot;
  SelectedValue=&quot;{Binding SelectedItemCode}&quot;/&gt;
</pre>
<p>ViewModel code:</p>
<pre class="brush: csharp;">// Key = ItemCode, Value = Name
public IDictionary&lt;string, string&gt; Items{get; private set;}  

public string SelectedItemCode
{
 get
 {
  return Settings.Default.SelectedItemCode;
 }
 set
 {
  if (Settings.Default.SelectedItemCode != value)
  {
   Settings.Default.SelectedItemCode = value;
   OnPropertyChanged(&quot;SelectedItemCode&quot;);
  }
 }
}
</pre>
<p>A settings file is used to store the user selection. Of cause you have to save the settings e.g. if your view is closed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.2moveit.de/index.php/2010/06/binding-a-dictionary-to-a-combobox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

