我是Xamarin的新手,
以下是我的代码:
<ListView x:Name="boxActivitiesList" ItemTapped="boxActivitiesList_ItemTapped" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical" Padding="25" VerticalOptions="Start" HorizontalOptions="Start">
<Label Text="{Binding Box}" TextColor="BlueViolet" FontSize="16" FontAttributes="Bold" LineBreakMode="TailTruncation" />
<TableView IsVisible="{Binding IsVisible}" Intent="Settings" HasUnevenRows="True" BackgroundColor="White">
<TableRoot>
<TableSection>
<ViewCell>
<StackLayout Orientation="Horizontal" Padding="15,0">
<Label HorizontalOptions="Fill" Text="Remarks" VerticalOptions="Center" TextColor="Black"></Label>
<Editor x:Name="txtRemarks" HorizontalOptions="FillAndExpand"></Editor>
</StackLayout>
</ViewCell>
</TableSection>
</TableRoot>
</TableView>
<Button x:Name="btnSave" Text="Save" Clicked="btnSave_Clicked" CommandParameter="{Binding BoxId}" IsVisible="{Binding IsVisible}"></Button>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
当我单击Editor
时,键盘不显示。你能告诉我我做错了什么。
我不确定为什么Editor
在Table
中不起作用,但是我会重新考虑此设计,然后使用Grid
来实现您的父 ViewCell
内部更复杂的布局。
尽管您的使用方式应该没有错,但是如果不需要真正需要,它似乎确实会用更多的嵌套控件使事情变得过于复杂。ergo,嵌套表实际上应该只是诸如Grid
或StackPanel
最后, xamarin.forms 在最好的时间里,它可以在其支持的各种设备上有些善变。因此,最好使事情尽可能简单