locked
Drawing to screen from a WinRT component DLL

    Question

  • Hello,

    I'm trying to set up a gui from a c++ winrt component DLL that should take over the csharp application that calls it.

    I tried to add to the component the xaml/h/cpp blankpage files from the default xaml application template, resolved a few errors, but am stuck with the error

    BlankPage.xaml : XamlCompiler error WMC1002: x:Class type 'cppApp.BlankPage' is not found as a public type in the built binary.

    Any hints to resolve the error ?

    I also tried to draw to the screen from the component using direct2d but the following lines are throwing an exception:

          auto directXAppSource = ref new DirectXAppSource();
          CoreApplication::Run(directXAppSource);

    (I merged the files from the visual studio c++ direct2d template with an empty winrt component dll)

    Any help would be appreciated for these two cases, or if you know another way to do what I need.

    Thank you in advance !

    Wednesday, April 18, 2012 1:49 PM

Answers

  • Your component DLL cannot take over the drawing in that way. You can mix Xaml and DirectX drawing using DirectX and XAML interop. The host application should be the primary owner of the UI and then call into the component DLL to perform whatever drawing is necessary.

    --Rob

    • Marked as answer by jo.imm Wednesday, June 12, 2013 2:30 PM
    Thursday, April 19, 2012 2:32 AM
    Owner

All replies

  • Your component DLL cannot take over the drawing in that way. You can mix Xaml and DirectX drawing using DirectX and XAML interop. The host application should be the primary owner of the UI and then call into the component DLL to perform whatever drawing is necessary.

    --Rob

    • Marked as answer by jo.imm Wednesday, June 12, 2013 2:30 PM
    Thursday, April 19, 2012 2:32 AM
    Owner
  • Rob,

    Thank you for your answer. Does it means I can use a directx object
    (that is created by the host application) in the winRT component ?

    Monday, April 23, 2012 3:04 PM