WPF - 从 WPF 应用程序切换到 xbap [英] WPF - Switching from WPF app to xbap

查看:42
本文介绍了WPF - 从 WPF 应用程序切换到 xbap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可用的 WPF 应用程序.我希望看到它作为 xbap 运行.我需要在 WPF 应用程序中进行哪些更改才能使其作为 xbap 运行?

I have a working WPF application. I would like to see it running as an xbap. What do I need to change in my WPF app to make it run as an xbap?

推荐答案

说到你可以用图形做什么,两者的唯一区别是 XBAP 不能使用 BitmapEffects.除此之外,沙箱安全问题几乎是您唯一需要处理的事情.大多数纯 WPF 程序应该可以顺利过渡.

When it comes to what you can do graphically, the only difference between the two is that XBAP can't use BitmapEffects. Other than that, the sandbox security issues are pretty much the only things you need to deal with. Most pure WPF programs should transition smoothly.

看看这个 比较 WPF 和 XBAP 之间的差异.

这是一个创建 XBAP 应用程序的教程.

在此基础上,您可以进行相当简单的重构,以便为您的程序同时容纳 WPF 和 XBAP.

Based on that there's a fairly simple refactor you can do to accommodate both WPF and XBAP for your program.

  • 首先,将所有 WPF 代码移动到一个与核心分离的 .dll 项目WPF EXE 项目.在您的核心 WPF EXE 项目中引用此项目.
  • 修改EXE项目的App.xaml指向来自 .dll 的主页项目.
  • 创建一个新的 XBAP 项目.
  • 在您的 XBAP 项目中引用上面提到的 dll 项目
  • 修改 XBAP 项目的 App.xaml 以指向 .dll 中的主页
  • 发布并运行.

这篇关于WPF - 从 WPF 应用程序切换到 xbap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆