Implementing IValueConverter interface in Silverlight
i have the following IValueConverter implementation
public class MyValueConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { var uri = new Uri((string)(value), UriKind.RelativeOrAbsolute); var img = new BitmapImage(uri); return img; } catch { return new BitmapImage(); } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var img = value as BitmapImage; return img.UriSource.AbsoluteUri; }
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog