WriteableBitmap with Image flickering when updated RRS feed

  • Question

  • I am using .NET 3.5 SP1, using a WriteableBitmap that is the source for an Image.

    What I'm noticing is that whenever I update my WriteableBitmap, I'm getting screen flashes.

    I only have one single call to WritePixels.  I have also tried locking using the BackBuffer and got the same results.

    I slowed the updates down to once per second and I can see the flash each time it updates.

    I've tried both re-assigning the Source property of the image each time as well as only assigning the Source once.

    I've also tried ping-ponging between two WriteableBitmaps.

    When updating, my CPU utilization is pretty much zero.

    I'm running on XP, but I tested it on Vista and had the same results.

    The reason the flicker is obvious is that my WritableImage is scrolling.  It is a data display where the data is drawn on the WriteableImage in a downward scrolling fashion (so the newest data is always on top).  However, I tried changing it so that it just changed the background color to something radically different and the flicker is still obvious.

    This size of the bitmap is irrelevant.  The flashing is just as obvious at 100x100 as it is at 1000x1000.

    It is also not simply flashing to the background color then updating.  Remember that this is scrolling downward, so each row will be a copy of the one above it.  If there is a section that is a solid vertical bar, it does not show the flicker.  However, if every other row is a black line, the flicker is painfully obvious.  It's almost as if I'm first seeing a double-image, then the final image.  I tried changing to a non-transparent PixelFormat but that didn't work either.  It can't be an anti-aliasing thing either, because at once per second the image wouldn't flash (it would just change and stick until the next update).

    At 30 frames per second it'll give you some serious eye-strain.  Any help would be appreciated.

    Thursday, March 19, 2009 7:51 PM

All replies

  • Can you send a small, self-contained repro project to me at brendan DOT clark AT microsoft DOT com, I'll take a look at it.

    Thursday, March 26, 2009 10:25 PM
  • Hi, I know this post is a bit old now, but I am experiencing a similar issue. Did you ever resolve this?
    Tuesday, July 26, 2011 3:04 PM