Skip to content

Instantly share code, notes, and snippets.

@curtismitchell
Created May 22, 2011 21:26
Show Gist options
  • Save curtismitchell/985911 to your computer and use it in GitHub Desktop.
Save curtismitchell/985911 to your computer and use it in GitHub Desktop.
Loading external xaml file with IronPython
import clr
clr.AddReference("PresentationFramework")
clr.AddReference("PresentationCore")
from System.Windows import Window, Application
from System.Windows.Markup import XamlReader
from System.IO import File, Path
class XamlWindow(Window):
def __init__(self, name):
self.load_xaml(name)
def load_xaml(self, name):
xaml_file = File.OpenRead(Path.GetFullPath(name))
self.Content = XamlReader.Load(xaml_file)
Application().Run(XamlWindow("mainui.xaml"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment