动态地选择XAML文件[英] Dynamically select XAML file

本文是小编为大家收集整理的关于动态地选择XAML文件的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

在执行代码时 xxxx.xaml 和 xxxx.xaml.c 相互链接并被执行.但我想知道一些使 yyyy.xaml 在运行时与 xxxx.xaml.c 链接的方法.所以我可以有不同的 xaml 文件并根据事件调用每个文件.我的怀疑可能超出范围或愚蠢!还是希望能有所收获

在此先感谢

推荐答案

听起来您需要一个 TemplateSelector.我不会按照你的想法走;-)

http://www.switchonthecode.com/tutorials/wpf-tutorial-how-to-use-a-datatemplateselector[^]

看看http://forums.silverlight.net/t/1611.aspx[^] 或这个 http://blogs.msdn.com/b/ashish/archive/2007/08/14/dynamically-loading-xaml.aspx[^]

本文地址:https://www.itbaoku.cn/post/1395201.html

问题描述

while execution of a code xxxx.xaml and xxxx.xaml.c are linked each other and getting executed . but i would like to know about some method which makes yyyy.xaml to link with xxxx.xaml.c during run time. so I can have different xaml files and call each one based on events . my doubt may be beyond the scope or foolish !!! still i hope there will be something

thanks in advance

推荐答案

It sounds like you need a TemplateSelector. I wouldn''t go down the route your thinking ;-)

http://www.switchonthecode.com/tutorials/wpf-tutorial-how-to-use-a-datatemplateselector[^]

Take a look at http://forums.silverlight.net/t/1611.aspx[^] or this http://blogs.msdn.com/b/ashish/archive/2007/08/14/dynamically-loading-xaml.aspx[^]