使用C#在Windows中的xaml页面中将Xaml文件加载到Container(例如:Canvas)中 [英] Load Xaml file in a Container (eg: Canvas) in a xaml page in WPF using C#
本文介绍了使用C#在Windows中的xaml页面中将Xaml文件加载到Container(例如:Canvas)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我建议如何在容器中加载Xaml文件(例如:画布或者请建议任何在WPF的xaml页面中的其他合适的容器。
解决方案以及代码非常感谢。
提前致谢。
解决方案
我不确定你是否可以制作一个页面Canvas
的子项,但肯定可能是另一个Canvas
实例。您可以从XAML文件中读取Canvas
对象并插入其结果。
适当的XAML,你可以使用开源的Inkscape(精彩的应用程序,必须拥有,特别是对于开发人员),绘制一些东西并导出绘图为XAML:
http://en.wikipedia.org/wiki/Inkscape [ ^ ],
http://www.inkscape .org / [ ^ ]。
也许您需要手动删除不需要的Name属性。据我记得,我不得不对Inkscape导出进行一些手动清理,但它可以轻松实现自动化。
-SA
Hi,
Can anybody help me to suggest how to Load Xaml file in a Container (eg: Canvas or please suggest any other suitable container) in a xaml page in WPF.
Solution along with code is highly appreciated.
Thanks in advance.
解决方案
I''m not sure you can make a page a child ofCanvas
, but it surely could be anotherCanvas
instance. You can read aCanvas
object from the XAML file and insert the result of it.
For a sample of appropriate XAML, you can use use open-source Inkscape (wonderful application, a must to have, especially for a developer), draw something and export drawing as XAML:
http://en.wikipedia.org/wiki/Inkscape[^],
http://www.inkscape.org/[^].
Perhaps you need to manually remove unwanted Name attributes. As far as I remember, I had to do some manual cleanup of the Inkscape export, but it can easily be automated.
—SA
这篇关于使用C#在Windows中的xaml页面中将Xaml文件加载到Container(例如:Canvas)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文