8
\$\begingroup\$

How can I render some graphics using XNA to a widget/control in a WPF app? Specifically, I don't need any WPF controls inside the XNA graphics window, I just want to put some controls around it for a level editor.

\$\endgroup\$
4
\$\begingroup\$

Nick Gravelyn explains how to do it on his blog.

Although, if it's just for an editor, you may find using WinForms is easier and better supported.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Really? I only made the switch because WPF is all the rage. I don't mind WinForms at all actually...never really cared for XAML. Binding is pretty cool though....gotta figure out the equivalent of binding in WinForms... \$\endgroup\$ – mpen Nov 8 '10 at 6:14
  • \$\begingroup\$ I don't have a good site suggestion so I'll just provide this google search: google.com/… \$\endgroup\$ – smack0007 Nov 8 '10 at 19:48
1
\$\begingroup\$

You can use reflection to snag the Direct3D render target handle and hook it up with D3DImage. I've done this successfully with WPF and XNA 3.1, but I had some issues with XNA 4.0 because they changed the surface format mappings. But supposedly other people have gotten it working with XNA 4.0.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.