[ACCEPTED]-programmatically using a value converter in C# in Silverlight-silverlight
Accepted answer
If you just want to call the converter explicitly 3 in the code behind, just use the converter 2 class just like any other class and call 1 its Convert() methos with appropriate parameters
YourConverter conv = new YourConverter();
conv.Convert(...)
I personally add a static method to the 4 converter like so:
public static object Convert(object value)
{
return new MyConverter().Convert(value, null, null, CultureInfo.CurrentCulture);
}
You can then use this 3 in code like so:
MyConverter.Convert(valueToConvert);
You can even change the 2 return type and cast the result before returning 1 to make usage easier.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.