【发布时间】:2020-04-19 12:55:33
【问题描述】:
我有一个简单的网格:
<Grid Grid.Row="5" x:Name="row5_piccat">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton
Aspect="AspectFit"
x:Name="btn_dummy_piccat2"
Grid.Column="1"
Source="btn_emptydummy.png" BackgroundColor="#00000000"/>
<Entry x:Name="entry_descri_pickcate"
Grid.Column="1"
FontFamily="arial"
MaxLength="50"
Placeholder="Kurzbeschreibung"
BackgroundColor="#00000000"
TextColor="#272727"
HorizontalOptions="Center"
VerticalOptions="Center">
</Entry>
</Grid>
现在,如您所见,此网格内有布局,在第 1 列。
现在我想用红色框以编程方式交换该网格的内容:
private void SetLayoutForTakers()
{
btn_dummy_piccat2.IsVisible = false;
entry_descri_pickcate.IsVisible = false;
Grid grid = new Grid(); //Neues Grid
BoxView bx = new BoxView();
bx.Color = Xamarin.Forms.Color.Red;
grid.Children.Add(bx);
row5_piccat.Children.Add(grid);
}
但是红色框总是设置在第一列而不是第二列(这里是数字 1,因为它是基于 0 的)。
如何处理已存在图像按钮和条目的特定列,禁用它们(已完成)并仅在此列中显示一个红色框? (第 0 行,第 1 列)?
谢谢你:)
【问题讨论】:
标签: xamarin.forms