Published articles on other web sites*

Published articles on other web sites*

WPF vs. Silverlight - Part 3 - Creating Bitmaps Programmatically

WPF Requires you to call BeginInit and EndInit before and after setting the source. Also the load failed handlers are different.
BitmapImage bmi = new BitmapImage();
#if !SILVERLIGHT
bmi.BeginInit();
#endif
Image img = new Image();
bmi.UriSource = new Uri(strUrl, UriKind.Absolute);
#if SILVERLIGHT
img.ImageFailed += img_ImageFailed;
#else
bmi.DownloadFailed += bmi_DownloadFailed;
bmi.EndInit();
#endif
Image myImage = new Image();
myImage.Source = bmi;

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...