Created
May 22, 2011 21:26
-
-
Save curtismitchell/985911 to your computer and use it in GitHub Desktop.
Loading external xaml file with IronPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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