File tree 2 files changed +57
-0
lines changed
2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ import clr
2
+ import sys
3
+ if sys .platform .lower () not in ['cli' ,'win32' ]:
4
+ print ("only windows is supported for wpf" )
5
+ clr .AddReference (r"wpf\PresentationFramework" )
6
+ from System .IO import StreamReader
7
+ from System .Windows .Markup import XamlReader
8
+ from System .Threading import Thread , ThreadStart , ApartmentState
9
+ from System .Windows import Application , Window
10
+
11
+
12
+ class MyWindow (Window ):
13
+ def __init__ (self ):
14
+ stream = StreamReader ("DynamicGrid.xaml" )
15
+ window = XamlReader .Load (stream .BaseStream )
16
+ Application ().Run (window )
17
+
18
+
19
+ if __name__ == '__main__' :
20
+ thread = Thread (ThreadStart (MyWindow ))
21
+ thread .SetApartmentState (ApartmentState .STA )
22
+ thread .Start ()
23
+ thread .Join ()
Original file line number Diff line number Diff line change
1
+ <Window
2
+ xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+ xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
4
+ Title =" WpfApplication1" Height =" 300" Width =" 300" >
5
+ <Grid >
6
+ <Grid .RowDefinitions>
7
+ <RowDefinition Height =" *" />
8
+ <RowDefinition Height =" Auto" />
9
+ <RowDefinition Height =" *" />
10
+ </Grid .RowDefinitions>
11
+ <Grid .ColumnDefinitions>
12
+ <ColumnDefinition Width =" *" />
13
+ <ColumnDefinition Width =" Auto" />
14
+ <ColumnDefinition Width =" *" />
15
+ </Grid .ColumnDefinitions>
16
+ <Label Content =" Left" Grid.Column=" 0" Background =" LightBlue" />
17
+ <GridSplitter
18
+ VerticalAlignment =" Stretch"
19
+ HorizontalAlignment =" Stretch"
20
+ Grid.Column=" 1"
21
+ Width =" 5"
22
+ Grid.RowSpan=" 3" />
23
+ <Label Content =" Right" Grid.Column=" 2" Grid.Row=" 2" Background =" LightBlue" />
24
+ <Label Content =" Top" Grid.Column=" 2" Background =" LightGreen" />
25
+ <GridSplitter
26
+ HorizontalAlignment =" Stretch"
27
+ VerticalAlignment =" Stretch"
28
+ Grid.Row=" 1"
29
+ Width =" Auto"
30
+ Height =" 5"
31
+ Grid.ColumnSpan=" 3" />
32
+ <Label Content =" Bottom" Grid.Column=" 0" Grid.Row=" 2" Background =" LightGreen" />
33
+ </Grid >
34
+ </Window >
You can’t perform that action at this time.
0 commit comments