<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>IValueConverter: The Swiss Army Knife of Bindings [PropertyViewer sample is a WPF/Silverlight visualization and debugging aid!]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx</link><description>If you've made much use of data binding in WPF or Silverlight, you've probably come across the IValueConverter interface. IValueConverter sits between the data source and destination and gives the developer a chance to examine/alter/replace the data as</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: IValueConverter: The Swiss Army Knife of Bindings [PropertyViewer sample is a WPF/Silverlight visualization and debugging aid!]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8462550</link><pubDate>Tue, 06 May 2008 11:57:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8462550</guid><dc:creator>vgsbs</dc:creator><description>&lt;p&gt;Cool - I really appreciate you do everything for both Silverlight and WPF.&lt;/p&gt;
</description></item><item><title>May 20th Links: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8526514</link><pubDate>Wed, 21 May 2008 08:03:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8526514</guid><dc:creator>ScottGu's Blog</dc:creator><description>&lt;p&gt;Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately&lt;/p&gt;
</description></item><item><title>May 20th Links: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8526590</link><pubDate>Wed, 21 May 2008 08:35:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8526590</guid><dc:creator>BusinessRx Reading List</dc:creator><description>&lt;p&gt;Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately.&amp;amp;#160;&lt;/p&gt;
</description></item><item><title>May 20th Links: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8526628</link><pubDate>Wed, 21 May 2008 08:50:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8526628</guid><dc:creator>Mirrored Blogs</dc:creator><description>&lt;p&gt;Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately&lt;/p&gt;
</description></item><item><title>Links op 20 mei: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8545141</link><pubDate>Sat, 24 May 2008 10:35:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8545141</guid><dc:creator>Scott Guthrie's Blog in Dutch</dc:creator><description>&lt;p&gt;Mijn verontschuldigingen voor de weinige posts de laatste weken. Mijn werk en leven zijn enorm de druk&lt;/p&gt;
</description></item><item><title>Liens du 20 mai: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF </title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8570942</link><pubDate>Tue, 03 Jun 2008 07:41:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8570942</guid><dc:creator>Scott Guthrie's Blog in French</dc:creator><description>&lt;p&gt;Mes excuses pour le peu de publications au cours des derni&amp;#232;res semaines – le travail et la vie en g&amp;#233;n&amp;#233;rale&lt;/p&gt;
</description></item><item><title>May 20th Links: ASP.NET, ASP.NET AJAX, .NET, Visual Studio, Silverlight, WPF</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8601184</link><pubDate>Sun, 15 Jun 2008 18:25:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8601184</guid><dc:creator>Readed By Wrocław NUG members</dc:creator><description>&lt;p&gt;Apologies for the sparseness of my posting the last few weeks - work and life have been busy here lately&lt;/p&gt;
</description></item><item><title>Question</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8689657</link><pubDate>Fri, 04 Jul 2008 18:20:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8689657</guid><dc:creator>Miguel Madero</dc:creator><description>&lt;p&gt;It's a great example. &lt;/p&gt;
&lt;p&gt;Just as a comment, I like the way Ruby On Rails simplify the binding to objects, letting you get friendly names using the Humanize method. That way using an attribute as [DisplayName(&amp;quot;Eats Bugs&amp;quot;)] is not need just to split the PropertyName based on the case. Altough the attribute gives you more control. &lt;/p&gt;
&lt;p&gt;I can see how IValueConverter can be useful in certain escenarios, but most of the time using a FormString would be easier.&lt;/p&gt;
&lt;p&gt;I dont know if there's something like that in SL or WPF. I did a trick to do something similar using ValueConverters, it work fine, but I think there should be a sexier solution. &lt;/p&gt;
&lt;p&gt;Here's the XAML. &lt;/p&gt;
&lt;p&gt;&amp;lt;UserControl.Resources&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;local:StringFormatConverter x:Name=&amp;quot;stringFormatter&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/UserControl.Resources&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;StackPanel Orientation=&amp;quot;Vertical&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;StackPanel.DataContext&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;SilverlightApplication3:Person/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/StackPanel.DataContext&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;TextBlock HorizontalAlignment=&amp;quot;Left&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Text=&amp;quot;{Binding Mode=OneWay, Path=Name}&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;TextBlock HorizontalAlignment=&amp;quot;Left&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Text=&amp;quot;{Binding Mode=OneWay, Path=LastName}&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;TextBlock HorizontalAlignment=&amp;quot;Left&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Text='{Binding Mode=OneWay, Path=DOB, Converter={StaticResource stringFormatter}, ConverterParameter=&amp;quot;d&amp;quot;}' TextWrapping=&amp;quot;Wrap&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;TextBlock HorizontalAlignment=&amp;quot;Left&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Text='{Binding Mode=OneWay, Path=Age, Converter={StaticResource stringFormatter}, ConverterParameter=&amp;quot;c&amp;quot;}' TextWrapping=&amp;quot;Wrap&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;TextBlock HorizontalAlignment=&amp;quot;Left&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Text='{Binding Mode=OneWay, Path=AnualIncome, Converter={StaticResource stringFormatter}, ConverterParameter=&amp;quot;0.00&amp;quot;}' TextWrapping=&amp;quot;Wrap&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/StackPanel&amp;gt;&lt;/p&gt;
&lt;p&gt;Here's de Code&lt;/p&gt;
&lt;p&gt;public class StringFormatConverter:IValueConverter&lt;/p&gt;
&lt;p&gt; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region IValueConverter Members&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string formatString = parameter.ToString();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return String.Format(&amp;quot;{0:&amp;quot; + formatString + &amp;quot;}&amp;quot;, value);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new NotImplementedException(&amp;quot;This Convert supports only OneWay binding&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; #endregion&lt;/p&gt;
&lt;p&gt; &amp;nbsp; }&lt;/p&gt;
</description></item><item><title>re: IValueConverter: The Swiss Army Knife of Bindings [PropertyViewer sample is a WPF/Silverlight visualization and debugging aid!]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8692778</link><pubDate>Sat, 05 Jul 2008 10:01:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8692778</guid><dc:creator>Delay</dc:creator><description>&lt;p&gt;Miguel,&lt;/p&gt;
&lt;p&gt;Thanks for the kind words - and brief Ruby On Rails lesson! :) I think your approach to string formatting is totally reasonable and it's something I've done once or twice as well. For what it's worth, this scenario should be much easier in WPF 3.5 SP1 because they've added the Binding.StringFormat property (details here: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/vinsibal/archive/2008/05/16/new-wpf-sp1-feature-data-formatting.aspx"&gt;http://blogs.msdn.com/vinsibal/archive/2008/05/16/new-wpf-sp1-feature-data-formatting.aspx&lt;/a&gt;). I'm not thinking that'll make it into Silverlight 2, but it sure would be nice!&lt;/p&gt;
</description></item><item><title>Silverlight 文章收集</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8762971</link><pubDate>Tue, 22 Jul 2008 05:36:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762971</guid><dc:creator>木野狐(Neil Chen)</dc:creator><description>&lt;p&gt;(以下内容全部整理自博客堂Scottgu博客中文版)Silverlight技巧，诀窍，教程和链接 【原文地址】SilverlightTips,Tricks,...&lt;/p&gt;
</description></item><item><title>Make life a little easier for designers [WPF Triggers with a little less XAML and a little less code]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#8945999</link><pubDate>Fri, 12 Sep 2008 10:22:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8945999</guid><dc:creator>Delay's Blog</dc:creator><description>&lt;p&gt;When I was writing my video frame grabbing sample , I came up with a potentially useful technique for&lt;/p&gt;
</description></item><item><title>Columns of a different color [Customizing the appearance of Silverlight charts with re-templating and MVVM]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#9395859</link><pubDate>Wed, 04 Feb 2009 18:02:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9395859</guid><dc:creator>Microsoft Weblogs</dc:creator><description>&lt;p&gt;When we created Silverlight Charting (background reading here and here ), we tried to make things as&lt;/p&gt;
</description></item><item><title>Code improvement suggestion</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#9441637</link><pubDate>Mon, 23 Feb 2009 21:50:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9441637</guid><dc:creator>vasche</dc:creator><description>&lt;p&gt;The only comment to the author - stop being a wuss and stop using &amp;quot;null != ...&amp;quot; or &amp;quot;0 == &amp;quot; syntax. Or do you talk in the same way? &amp;quot;if seven dollars costs a beer, then anymore it's not a happy hour&amp;quot;. Sheesh...&lt;/p&gt;
</description></item><item><title>Peanut butter jelly time [How to: Create a pleasing visual effect with Silverlight/WPF Charting]</title><link>http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx#9754487</link><pubDate>Mon, 15 Jun 2009 22:14:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9754487</guid><dc:creator>Delay's Blog</dc:creator><description>&lt;p&gt;I was recently part of an e-mail thread with Pete Brown discussing the prospects of reproducing Richard&lt;/p&gt;
</description></item></channel></rss>