// imgLogo is WPF image so need to bind it from Bitmap or Image.
// following code.. to bind image. try this it will work in WPF or Silverlight application
System.Drawing.Bitmap dImg = new System.Drawing.Bitmap(ApplicationVariables.TenantImage);
MemoryStream ms = new MemoryStream();
dImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
BitmapImage bImg = new BitmapImage();
bImg.BeginInit();
bImg.StreamSource = new MemoryStream(ms.ToArray());
bImg.EndInit();
this.imgLogo.Source = bImg;
// following code.. to bind image. try this it will work in WPF or Silverlight application
System.Drawing.Bitmap dImg = new System.Drawing.Bitmap(ApplicationVariables.TenantImage);
MemoryStream ms = new MemoryStream();
dImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
BitmapImage bImg = new BitmapImage();
bImg.BeginInit();
bImg.StreamSource = new MemoryStream(ms.ToArray());
bImg.EndInit();
this.imgLogo.Source = bImg;
No comments:
Post a Comment