In Silverlight 3.0 we use Converts for custom Binding format. To do we Implement the following Interface and its Two Methods.
Now In Silverlight 4.0 we have BindingBase class can relieve us from writing a converter in some situation .
Here we are going to see the following three properties of BindingBase class . TargetNullValue,StringFormat, and FallbackValue.
Here I have Contacts Class with some properties. one of the property is Age is nullable type. suppose if Age is null we are going to display Text AgeNotknown. using TargetNullValue.
Here we are going to format the Data of birth property.
For example let say we have two classes Contacts and MyClassMate
There is a situation when an interface would bind to either an instance of Contacts or MyClassMate . The Year property is available only on MyClassMate . If we are binding an Contacts instance, no value would be displayed for this property. The FallbackValue can be used in this case to indicate that if the property is not found.
Here is XAML code to set FallbackValue.