Skip to main content

Posts

Showing posts with the label Data Binding

Windows 8 & Data Binding. Part 4–Data Conversion

In Part 3 of this little mini-series on data binding in Windows 8 we looked at Element Binding. Today, we'll take a look at Data Conversion.

At times the data in your business object (the source for your binding) and the target UIElement may not have an exact type match. For example, if your Employee class wants to keep track of the start date for each Employee, a sensible way to do so is with a DateTime object. However, when we display that data we'll want to use a Text object, and we may not want the entire default conversion of a DateTime to a string. To rectify this problem, we can create a class that performs a conversion from one type to another (in this case, from DateTime to string). This class will implement IValueConverter and will have two methods: Convert, and ConvertBack.

Read More from: Original Source

I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful,…