可以使用XAML声明WPF组件以外的其他对象吗? [英] Can XAML be used to declare other objects than WPF components?

查看:78
本文介绍了可以使用XAML声明WPF组件以外的其他对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了XNA图形引擎,该引擎具有非常声明性的场景建模方法.通过创建各种对象(模型,纹理,相机等)的实例,并设置其属性来将场景放在一起.最后,您有一个大的场景对象,可以将其传递给引擎,并可以自动进行渲染和动画处理.

声明场景与在WPF中将表单组合在一起并没有太大区别,我问自己是否不能使用XAML来编写场景.因此,问题是,XAML是否独立于WPF的组件和控件,是否可以用于声明任意对象的实例.如果您认为可以做到,请指出正确的方向.

I have written a XNA graphics engine which has a very declarative approach to modelling scenes. A scene is put together be creating instances of various objects (Models, Textures, Cameras and the like), setting their properties. In the end you have one big scene object which can be passed on to the engine and can be rendered and animated automatically.

Declaring a scene is not very different from putting together a form in WPF and I asked myself, if I could not put XAML to use to author the scenes. So the question is, if XAML is independent of WPF''s components and controls and can be used to declare instances of arbitary objects or not. Please point me in the right direction if you think this can be done.

推荐答案

否. XAML是一个布局管理器,仅此而已.
No. XAML is a layout manager - nothing more.


XAML比需要在WPF/WF或Silverlight中使用更通用.在.NET 4中,引入了XAML2009(位于System.XAML库中),它提供了通用的XAML功能.看看
XAML is much more general purpose than needing to be used in WPF/WF or Silverlight. With .NET 4, XAML2009 was introduced (it''s in the System.XAML library) and it provides general purpose XAML functionality. Have a look here[^] for more details.


这篇关于可以使用XAML声明WPF组件以外的其他对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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