XAML and Boo in Sharpdevelop
-
29-09-2020 - |
Question
I am able to create and run boo console applications in Sharpdevelop.
Is there a way to specify the UI using XAML markup and write the code behind in boo for WPF development in Sharpdevelop? If not is there any other alternative for WPF development in boo?
Solution
The build option 'Page' for XAML requires that the XamlMarkupCompiler (included with MSBuild) outputs code in the project's language. That's only supported for C# and VB.
However, you could use the build option 'EmbeddedResource' and then parse the .xaml at runtime using XamlLoader.
OTHER TIPS
Here's an example implementation, extracted from http://devpinoy.org/blogs/smash/archive/2006/10/04/XAMl-meets-Boo.aspx (down)
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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow