I understand that there are several ways to blend XNA and WPF within the same application. I find it enticing to use WPF for all GUI and HUD stuff in my XNA games. Does anyone have any practical experience on how well this approach works in real life using .NET 3.5 SP1 ? Any pitfalls (such as the "airspace problem")? Any hint on what appoach works best?
There are is an addition in 3.5 SP1 that allow better interaction between DirectX and WPF (D3DImage), and one way to get to that is through XNA.
Here is some details:
http://jmorrill.hjtcentral.com/Default.aspx?tabid=428&EntryID=259
Thamir Khason presented a excellent session about WPF/XNA/Silverlight at Tech-ed... Here is his slides: http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/14/my-teched-08-presentation-slides-download.aspx
PS. This was quite impressive to see... he had a game that ran on the xbox. On his desktop using WPF to host XNA and ons his mobile phone using silverlight all playing against each other!!!
I personally would advise against trying to do this integration. I know what you're going for ... the ease of defining GUI/HUD elements in WPF greatly outweighs trying to do the same in just plain old XNA. However, think realistically of the time you'll spend trying to enable this scenario vs. how much you'd save if you just did everything "natively" in XNA. Also (and this may not be an issue for you), WPF isn't supported on the xbox or zune ... so you'd be limiting yourself :-)
XNA integration is high on our list of things to add to WPF so we're looking in to this for future versions. Stay tuned (to GregSc's blog) for the details as they become available.
Ian Ellison-Taylor
Read more about this here
Hey I know this is a while after you posted but if you are still looking for a WPF solution for XNA you may want to keep an eye on http://red-badger.com/product. The XPF soloution puts wpf into XNA. SO have a look, at the moment it is free as it is in beta but that will be changing as they add more components
You want to use a D3DImage, but D3DImage works different on windows XP vs windows Vista or 7.
On Vista or 7, you create a NON-lockable renderTarget to use with the D3DImage & you use a Direct3D9EX Device. On XP, you create a lockable renderTarget to use with the D3DImage & use a normal Direct3D9 Device.
Also insted of using XNA it might be better to use SlimDX if your just making this for the PC. SlimDX is not lacking any Direct3D features & supports Direct3D 9, 10 & 11.