View Single Post
  #2 (permalink)  
Old May 16th, 2016, 01:15 PM
alexandarx5 alexandarx5 is offline
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2016
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default re. differentiate between data formatting and templating

Quote:
Originally Posted by lifeguru02 View Post
we use dapfor wpf gridcontrol in our department to do assignments and lessons. Our lecturer told us today to differentiate between data formatting and templating.
C#
internal class IntToStringConverter : IValueConverter
{
#region IValueConverter Members
// Converts int-type value to string
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int)
{
return string.Format(culture, "{0}", value);
}
return null;
}
// Parses string to int-type value
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string s = value as string;
if(!string.IsNullOrEmpty(s))
{
return int.Parse(s, culture);
}
return Binding.DoNothing;
}
#endregion
}
Reply With Quote