Domanda Drawing to screen from a WinRT component DLL

  • mercoledì 18 aprile 2012 13:49
     
     

    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 !

Tutte le risposte

  • giovedì 19 aprile 2012 02:32
    Moderatore
     
     

    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

  • lunedì 23 aprile 2012 15:04
     
     

    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 ?