我正在尝试以编程方式创建布局,但似乎无法弄清楚如何在其子级之一上设置Flexlayout的Grow属性
为澄清起见,我想以编程方式在Flexlayout的一个子级上应用“增长”,因此它占用了布局中的所有剩余空间
这是我要在C#中尝试执行的Xaml代码的示例
<StackLayout x:Name="ContainerLayout">
<FlexLayout Direction="Row">
<Editor Text="test"
FontSize="Large"
FlexLayout.Grow="1"/>
<ImageButton Source="add_btn"
HeightRequest="40"
WidthRequest="40"
IsVisible="True"
Clicked="Translation_Clicked"/>
<ImageButton Source="remove_btn"
HeightRequest="40"
WidthRequest="40"
IsVisible="False"
Clicked="Translation_Clicked"/>
</FlexLayout>
</StackLayout>
我想在运行时添加一些Flexlayout
到目前为止我的代码
FlexLayout flexLayout = new FlexLayout();
flexLayout.Direction = FlexDirection.Row;
Editor editor = new Editor();
editor.FontSize = Device.GetNamedSize(NamedSize.Large,typeof(Editor));
//Want to set Flexlayout.Grow to 1 here,so the editor takes the left space
ContainerLayout.Children.Add(flexLayout);