@@ -72,29 +72,41 @@ public struct WinUIBackend: AppBackend {
72
72
public func show( widget _: Widget ) { }
73
73
74
74
public func createVStack( ) -> Widget {
75
- StackPanel ( )
75
+ Grid ( )
76
76
}
77
77
78
78
public func addChild( _ child: Widget , toVStack container: Widget ) {
79
- ( container as! StackPanel ) . children. append ( child)
79
+ let grid = container as! Grid
80
+ let rowDefinition = RowDefinition ( )
81
+ if child. name != " Spacer " {
82
+ rowDefinition. height = GridLength ( value: 1 , gridUnitType: . auto)
83
+ }
84
+ Grid . setRow ( child, Int32 ( grid. rowDefinitions. count) )
85
+ grid. rowDefinitions. append ( rowDefinition)
86
+ grid. children. append ( child)
80
87
}
81
88
82
89
public func setSpacing( ofVStack widget: Widget , to spacing: Int ) {
83
- ( widget as! StackPanel ) . spacing = Double ( spacing)
90
+ ( widget as! Grid ) . rowSpacing = Double ( spacing)
84
91
}
85
92
86
93
public func createHStack( ) -> Widget {
87
- let stack = StackPanel ( )
88
- stack. orientation = . horizontal
89
- return stack
94
+ Grid ( )
90
95
}
91
96
92
97
public func addChild( _ child: Widget , toHStack container: Widget ) {
93
- ( container as! StackPanel ) . children. append ( child)
98
+ let grid = container as! Grid
99
+ let columnDefinition = ColumnDefinition ( )
100
+ if child. name != " Spacer " {
101
+ columnDefinition. width = GridLength ( value: 1 , gridUnitType: . auto)
102
+ }
103
+ Grid . setColumn ( child, Int32 ( grid. columnDefinitions. count) )
104
+ grid. columnDefinitions. append ( columnDefinition)
105
+ grid. children. append ( child)
94
106
}
95
107
96
108
public func setSpacing( ofHStack widget: Widget , to spacing: Int ) {
97
- ( widget as! StackPanel ) . spacing = Double ( spacing)
109
+ ( widget as! Grid ) . columnSpacing = Double ( spacing)
98
110
}
99
111
100
112
public func createSingleChildContainer( ) -> Widget {
0 commit comments