This is a mirror of official site: http://jasper-net.blogspot.com/

Using Value Converters in Silverlight

| Tuesday, October 5, 2010
When you start to bind data in Silverlight (or WPF for that matter) you will most likely have data that is in one format that you may need to convert to another format. For example if you have a decimal number (price) that is 19.95, you would want to display it as $19.95. Of course you can use a normal .NET format string to accomplish this, but you could also write some code to convert the decimal number 19.95 to a string with the dollar sign in front of it “$19.95”.

In the sample that you are going to read about, you have a Boolean value of true or false, and based on this true or false value you will return one bitmap image or another bitmap image. To accomplish this you need to tell Silverlight that instead of displaying the Boolean value that it should pass the Boolean value to a method in a class you create and have that method return a bitmap image back and to display that bitmap (Figure 1 and Figure 2).

SLValueConvert1.jpg

Read more: Paul Sheriff's Blog for the Real World

Posted via email from .NET Info

0 comments: