none
WPF in Task Pane has nasty Flicker, Excel RRS feed

  • Question

  • I have a task pane with a moderately complex WPF user control in it, which involves Flow Documents, and seems to take about 15ms to render.  It seems that the flicker happens during the render.

    The flicker is not just to white, but to black, which makes it look quite bad.  Or sometimes bits of the Excel graphics end up in it.  Have tried setting background colors of everything -- wpf control, elementHost, containing form.

    I am actually driving the .Net from VBA via com.  I update the display by
    m = new Model();
    m.properties=...;
    DataContext = m;
    Ie no events to confuse things.  (The model is completely different each time, so this should also be faster.)

    It seems to be mainly a WPF issue, not winForms. In both .net 3.5 and 4.0.  Excel 2010.

    It is difficult to reproduce in a small example.  But by updating a WPF model 100 times from VBA, DoEvents between, and ScreenUpdating = *False* it flickers a bit.  ScreenUpdating = True smooths it out(!). I think because in a small example each of the 100 WPF redraw is very quick, and the XL cleans it up before you can notice.

    Doing the 100 updates within .Net does not flicker, even with a
      wpf.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, EmptyDelegate);
    between them which seems to force the update to the screen.

    Any ideas most welcome.

    Anthony

    Anthony

    Friday, June 29, 2012 8:28 AM

Answers

  • I made the flicker go away by

    1. Ensuring that Applications.UpdateDisplay = True (ie do the updates, unoptimized).  Any change to this setting causes grief.

    2. Removing Application.Run calls which seemed to have a strange interaction.

    It now looks OK.  But there are strange things going on.

    Regards,

    Anthony


    Anthony

    Monday, July 2, 2012 6:52 AM

All replies

  • Hi Anthony,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into this issue to see whether them can help you. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 2, 2012 5:15 AM
    Moderator
  • I made the flicker go away by

    1. Ensuring that Applications.UpdateDisplay = True (ie do the updates, unoptimized).  Any change to this setting causes grief.

    2. Removing Application.Run calls which seemed to have a strange interaction.

    It now looks OK.  But there are strange things going on.

    Regards,

    Anthony


    Anthony

    Monday, July 2, 2012 6:52 AM
  • I made the flicker go away by

    1. Ensuring that Applications.UpdateDisplay = True (ie do the updates, unoptimized).  Any change to this setting causes grief.

    Anthony, I suppose you meant Application.ScreenUpdating = true?

    Forrest Guo | MSDN Community Support | Feedback to manager

    Monday, July 2, 2012 9:01 AM
    Moderator

  • Please see WPF Excel which allows you to create and manage Excel no nasty Flicker

    Monday, July 2, 2012 9:18 AM
  • Yes, ScreenUpdating -- oops.

    Anthony


    Anthony

    Monday, July 2, 2012 9:31 AM