In WPF it is easy to use a ValueConverter to format values etc, (in our case convert some numbers into a different unit, e.g km to miles)
I know it can be done in Winforms, but all my Googleing just brings up results for WPF and Silverlight.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a
TypeConverterif you’re able and willing to decorate the data source property with a custom attribute.Otherwise you have to attach to the
ParseandFormatevents of aBindingobject. This, unfortunately, eliminates using the designer for your binding for all but the simplest scenarios.For example, let’s say you wanted a
TextBoxbound to an integer column representing kilometers and you wanted the visual representation in miles:In the constructor:
…