Help with hooking up to the CompositionTarget.Rendering event RRS feed

  • Question

  • My C# is rusty… very rusty.

    In my App class I want to hook up to the CompositionTarget.Render event, and I’ve been trying to find the right syntax for 2 hours.

    In my app’s OnLaunched, I have the code:

     CompositionTarget.Rendering += OnCompositionTargetRendering;

    And a member function:

    private void OnCompositionTargetRendering(object sender, EventArgs e)


           // do stuff.


    I’m getting the error “No overload for ‘OnCompositionTargetRendering matches delegate ‘System.EventHandler<object>’

    I also have to check (say when the app becomes visible again) that I am still hooked up to the event... in C++, I make a token during the event registration I can check later... how would I check this in C#?

    Could someone please help me with the proper syntax?  (Wow... all this C++ has rusted my brain.)

    • Edited by HeadRoach Thursday, January 9, 2014 11:39 AM added question
    Thursday, January 9, 2014 11:32 AM


  • Seems that this is the proper syntax here:

    private void OnCompositionTargetRendering(object sender, object e);

    • Marked as answer by HeadRoach Thursday, January 9, 2014 10:06 PM
    Thursday, January 9, 2014 10:06 PM