I’m a newbie to Silverlight and I’m having some trouble finding a solution to an issue.
I have a silverlight datagrid with 3 columns. One of the columns is bound to an integer. I want to be able to bind my column to a function that would translate my integer into it’s status code. The function accepts an integer, and using a switch statement I return a string of what that number represents.
0 = Inactive
1 = Active
2 = Pending
etc
A lot of what I’ve found has been techniques for Element Binding, which is very cool, but not what I’m looking for.
You can create an IValueConverter that provides you the ability to invoke a function on the databound value.
You can customize the Convert method to return a string based on the value passed in :
IValueConverter on MSDN
IValueConverter example in Silverlight