May 12. 18:57 -  Yosemite http://t.co/jeiXPZQX

Silverlight 3 WriteableBitmap requires call to Invalidate() after Render()

September 6, 2009 18:20 by docbliny

All of the samples I cam across using WriteableBitmap seemed to be from a prerelease version. They call the constructor with an additional parameter and don't call Invalidate() which is required for the anything to actually show up in the bitmap.

private void UpdatePreview() {     
     WriteableBitmap bitmap = new WriteableBitmap((int)imageSource.Width,
                                     (int)imageSource.Height);
     bitmap.Render(imageSource, new TranslateTransform());
     bitmap.Invalidate();
     imgPreview.Source = bitmap;
}

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading