在运行时加载XAML? [英] Loading XAML at runtime?

查看:135
本文介绍了在运行时加载XAML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一是一些背景:我工作的一个应用程序,我试图按照惯例MVVM写它。有一件事我想要做的是能够给应用程序的不同皮肤我的应用程序。相同的应用程序,但示出了一个客户端一皮肤和一个不同的皮肤另一

First some background: I'm working on an application and I'm trying to follow MVVM conventions writing it. One thing I'd like to do is to be able to give the application different "skins" to my application. The same application, but show one "skin" for one client and a different "skin" for another.

所以我的问题是:结果
1.是否有可能在运行时加载XAML文件和分配到我的应用程序?结果
2. XAML文件可驻留在不同的文件夹中的外部文件?结果
3.可以很容易地,或者只在启动时应用程序切换到另一个XAML文件?结果

And so my questions are:
1. Is it possible to load a xaml file at run time and "assign" it to my app?
2. Can the xaml file be an external file residing in a different folder?
3. Can the application switch to another xaml file easily, or only at startup time?

所以,我应该从哪里开始寻找有关信息?其中WPF方法,如果存在的话,处理这个功能?

So where should I start looking at for information on this? Which WPF methods, if they exist, handle this functionality?

谢谢!

编辑:剥皮我想要做的类型不只是改变了我的控件的外观更加。这个想法是有一个完全不同的UI。不同的按钮,不同的布局。有点像如何应用程序的一个版本将功能齐全的专家和另一个版本将被简化为初学者。

the type of "skinning" I'm wanting to do is more than just changing the look of my controls. The idea is having a completely different UI. Different buttons, different layouts. Kinda like how one version of the app would be fully featured for experts and another version would be simplified for beginners.

推荐答案

我觉得这是与XamlReader相当简单,这给了一枪,没有尝试它自己,但我认为它应该工作。

I think this is fairly simple with the XamlReader, give this a shot, didn't try it myself, but I think it should work.

<一个href=\"http://blogs.msdn.com/ashish/archive/2007/08/14/dynamically-loading-xaml.aspx\">http://blogs.msdn.com/ashish/archive/2007/08/14/dynamically-loading-xaml.aspx

这篇关于在运行时加载XAML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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