My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# requires IronPython and .NET 3

import sys
import clr
clr.AddReference('PresentationFramework')
clr.AddReference('PresentationCore')
clr.AddReference('windowsbase')
from System.Windows.Controls import *
from System.Windows.Markup import XamlReader
from System.Windows import Window, Application

if len(sys.argv) == 1:
from Microsoft.Win32 import OpenFileDialog

dialog = OpenFileDialog()
dialog.ShowDialog()

filename = dialog.FileName
if filename is None:
sys.exit()
stream = dialog.OpenFile()
elif len(sys.argv) > 2:
print 'display_xaml [xaml_file]'
sys.exit(1)
else:
from System.IO import File
filename = sys.argv[1]
stream = File.OpenRead(filename)

reader = FlowDocumentReader()
flowDocument = XamlReader.Load(stream)
stream.Close()
reader.Document = flowDocument
w = Window()
w.Title = "Displaying %r" % filename
w.Content = reader
Application().Run(w)

Change log

r55 by fuzzyman on Aug 14, 2009   Diff
Tabs to spaces conversion.
Go to: 
Project members, sign in to write a code review

Older revisions

r54 by fuzzyman on Aug 14, 2009   Diff
Updating the display_xaml script.
r30 by fuzzyman on Aug 11, 2009   Diff
Script fixed.
r24 by fuzzyman on Aug 10, 2009   Diff
Adding an IronPython script for
displaying xaml
All revisions of this file

File info

Size: 923 bytes, 38 lines
Powered by Google Project Hosting