<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Re: Is this a ValueConverter scenario?</title><link>http://forums.silverlight.net/forums/thread/114963.aspx</link><pubDate>Wed, 22 Oct 2008 06:53:59 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:114963</guid><dc:creator>IanBlackburn</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/114963.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=114963</wfw:commentRss><description>&lt;p&gt;Using the linq expression to create the datasource would indeed require more memory, but the&amp;nbsp;binding would be quicker than using the ValueConvertor because the computation is done in advance.&amp;nbsp; So I guess it depends on where you need to optimise, and what you feel is more maintainable.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Re: Is this a ValueConverter scenario?</title><link>http://forums.silverlight.net/forums/thread/113019.aspx</link><pubDate>Mon, 20 Oct 2008 00:55:07 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:113019</guid><dc:creator>R3al1ty</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/113019.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=113019</wfw:commentRss><description>&lt;p&gt;Thanks Manish, excellent series of articles. I went down the route of adding SelectedValue to my controls rather than modify my data access classes. For lists, I use SelectedValue and for single item binding like textboxes, I use a custom ValueConverter.&lt;/p&gt;
&lt;p&gt;Ian, when used across the whole app, I think it might clutter up the code a bit with custom joins for each binding. I&amp;#39;m also not sure how the CLR does mem management for strings; if I have one string object (e.g. &amp;#39;France&amp;#39;) in 100 objects, are there 100 instances in memory of the string?&lt;/p&gt;</description></item><item><title>Re: Is this a ValueConverter scenario?</title><link>http://forums.silverlight.net/forums/thread/112995.aspx</link><pubDate>Sun, 19 Oct 2008 23:24:11 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:112995</guid><dc:creator>manish.dalal</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/112995.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=112995</wfw:commentRss><description>&lt;p&gt;You need to add one more property to Person class and expose Code as value of that property. Once that is done, you can databind SelectedItem property of ComboBox to the&amp;nbsp;newly added property and DisplayMemberPath to the Description of Code. You can find details in my blog post on the same topic&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feeds.feedburner.com/~r/ManishDalal/~3/417137421/combobox-in-datagrid.aspx"&gt;http://feeds.feedburner.com/~r/ManishDalal/~3/417137421/combobox-in-datagrid.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Is this a ValueConverter scenario?</title><link>http://forums.silverlight.net/forums/thread/112547.aspx</link><pubDate>Sat, 18 Oct 2008 17:07:08 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:112547</guid><dc:creator>IanBlackburn</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/112547.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=112547</wfw:commentRss><description>&lt;p&gt;Possible, though I think I would prefer to provide the correct data in the first place.&amp;nbsp; You could use linq to build a new object with the data you need in it.&amp;nbsp; For example:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;List&amp;lt;Person&amp;gt; people = new List&amp;lt;Person&amp;gt;();&lt;br /&gt;&amp;nbsp;List&amp;lt;Codes&amp;gt; codes = new List&amp;lt;Codes&amp;gt;();&lt;br /&gt;&amp;nbsp;//TODO: populate people and codes with data...&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var results = from p in people&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; join c in codes on p.CountryID equals c.Code&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select new { p.CountryID, c.Code };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListBox1.ItemsSource = results;&lt;/p&gt;</description></item><item><title>Is this a ValueConverter scenario?</title><link>http://forums.silverlight.net/forums/thread/111521.aspx</link><pubDate>Fri, 17 Oct 2008 02:45:15 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:111521</guid><dc:creator>R3al1ty</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/111521.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=111521</wfw:commentRss><description>I have a Person class as below. The person&amp;#39;s CountryID&amp;nbsp;is bound to a ComboBox. The data is stored internally as IDs that need to be looked up in the Codes class to show the human readable text in the ComboBox (France, Japan etc rather than 1,2). Is this a good scenario to use a ValueConvertor and any pointers on how to structure it as there will be multiple entities to lookup in different scenarios (Country,Occupation etc)?&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; 
&lt;p&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;class&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Person&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; CountryID { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; OccupationID { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt;; }&lt;br /&gt;}&lt;font color="#0000ff" size="2"&gt;&lt;/p&gt;
&lt;p&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;class&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Codes&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; Code { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; Decode { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt;; }&lt;br /&gt;}&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;new Code( 1, &amp;quot;France&amp;quot; )&lt;br /&gt;new Code( 2, &amp;quot;Japan&amp;quot; )&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>