How to add XAML elements to a Direct3D App RRS feed

  • Question

  • We're porting our GIS application to Windows RT and have followed the design layout of some built-in Windows 8 applications such as IE10 metro, map, in which graphics objects are rendered in full screen mode with appbar popped up at the bottom of the screen in response to the right-tap event. We started with the "Direct3D App" template provided with Visual Studio 2012. Our problem is that we cannot figure out how to implement the appbar, none of the Windows 8 code sample shows that. So my question is how to add XAML elements to a Direct3D app?

    I know there is a "Direct2D App (XAML)" template that provide appbar out of the box. As far as I know, this template may be the only template that implements the SwapChainBackgroundPanel DirectX+XAML interop scheme, that is, no template for VirtualSurfaceImageSource DirectX+XAML interop scheme.

    • Edited by Leonard Thursday, October 4, 2012 2:30 PM
    Thursday, October 4, 2012 2:28 PM


All replies

  • You would want to create a DX XAML control that you render your map to, and then just create a normal XAML app after that. See my blogpost here: http://www.sharpgis.net/post/2012/04/26/Creating-a-DirectX-XAML-control-using-CPP_CX.aspx
    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:37 AM
    Thursday, October 4, 2012 3:04 PM
  • Thanks Morten. Though creating custom controls is a viable approach, I am afraid that this method may require a lot more work than just use built-in controls in VS if we started with the Direct2D App (XAML) template.
    Thursday, October 4, 2012 11:18 PM
  • Well you don't need to use a custom control, but you need some xaml control (border for instance) with a background/fill brush you can render your DX surface to.
    I just think that it would actually make it easier if you encapsulated it. Ie. you'll just insert <my:Map />.

    This is also how Bing Maps works, as well as the map control I'm building, and works great.

    Friday, October 5, 2012 6:14 AM
  • OK, I'll take a look at your article to see what role these controls play.
    Friday, October 5, 2012 7:13 AM