views:

989

answers:

2

Is it possible to use DirectX 10 (I am using SlimDX) with WPF's D3DImage? The only examples and docs I can find only show using DX9 surfaces.

+2  A: 

Not out of the box as far as I know. WPF is based on DirectX, but as WPF is also supported on Windows XP it's based on DirectX 9.

I do know that it's possible to use DirectX 10 with WPF, but then your application won't be able to run on XP.

There's a library for WPF called Bling which supports DirectX 10 (on Vista and Windows 7) which might be of interest to you. You can find it here. I don't know how mature it is though.

Also, I ran into this blog (mostly in french) who speaks about using DirectX 10 with WPF.

Lastly there's a good introduction to using D3DImage with DirectX over at CodeProject

I know this doesn't exactly answer your question, but I thought I'd share it with you anyways. Best of luck.

Tchami
Blind? Blod? Something wrong with your 'G' key? :P
Cameron MacFarland
oops, thanks :)
Tchami
A: 

Yes, you can use DirectX 10, 11, and DirectWrite using the D3DImage in WPF by creating your render target surface as shared, and then creating a DX9 texture based on that shared texture handle to use in WPF.

This means that essentially you can use 10, 11, and DirectWrite the same way you use DX9 with no additional overhead, and no airspace issues.

A sample WPF project with DX9, DX10, DX11, and DirectWrite integration can be found referenced in this blog post here:

http://blogs.windowsclient.net/rob_relyea/archive/2010/04/30/gizmodo-posts-wpf-direct2d-sample-wow.aspx

The Microsoft Code Pack contains a thin managed wrapper for Windows 7 components including DX9, DX10, DX11 and DirectWrite in addition to various other unmanaged libraries in Windows 7.

The SurfaceQueueInteropHelper is a WPF control that manages automatically creating DX9, 10, and 11 contexts in WPF and managing D3DImage updating and various other aspects of the rendering system including device lost events.

Ben Cooley