Adding WPF Windows to an XNA Game Project
I'm creating an experimental game (which would eventually become a map editor for a game) and I'd like to include a WPF window in the same project which would communicate with the game logic. This is not another render-xna-game-in-wpf-window question, I've read tons of those, I want to spawn a seperate WPF window independent from the XNA game window, but in 开发者_JS百科the same program, in the same project. When I click Add Item and select WPF, all it gives me as an option is a User Control, no window or any other options etc. I've tried referencing PresentationCore but no lock either, am I missing something? I am not super with interoperability, so forgive me if what I tried is stupid. I also don't want "hacky" solutions (like creating a window and a borderless control and setting their location same etc) if it can't be done just tell it so, but I'm sure there is a relatively "clean" way of doing it since they'll be completely seperate, think of it like a very simple MVC: M Game Logic, V XNA Window, C WPF Window. And don't offer me Forms, I know how to go with forms, but I want WPF, I just work with WPF/XAML and WPF style controls more easily.
Being able to add a Window from the Add Item menu is controlled by a Visual Studio project type GUID. Have you tried to create the window xaml and cs files manually (or create it in another, test solution and Add Existing file)? Or just create a Window instance in code and show that? Also, Window is in PresentationFramework, not PresentationCore.
精彩评论