答案 0 :(得分:1)
XAML的构建选项'Page'要求XamlMarkupCompiler(包含在MSBuild中)以项目的语言输出代码。这只支持C#和VB。
但是,您可以使用构建选项'EmbeddedResource',然后在运行时使用XamlLoader解析.xaml。
答案 1 :(得分:0)
这是一个从中提取的示例实现 http://devpinoy.org/blogs/smash/archive/2006/10/04/XAMl-meets-Boo.aspx(下)
import System
import System.Windows
import System.Windows.Markup
import System.Windows.Controls
import System.Windows.Controls.Primitives
import System.IO
import System.Xml
class XamlPanel:
"""Parses a xaml file, returning a Panel, offering node lookup with .Get(NodeName)"""
[Property(Panel)]
private _panel as Panel
public def constructor(filename as string):
# parse the element tree via the XamlReader
streamReader = StreamReader(filename)
xmlreader = XmlReader.Create(streamReader)
_panel = XamlReader.Load(xmlreader)
public def Get(nodeName as string):
return LogicalTreeHelper.FindLogicalNode(_panel, nodeName)