おなじみのXamarinプラットフォーム問題です。
ListViewのCellにTebleViewを設置し、そのViewCell中にEntryを置きました。
すると、iOSでは問題なく動くのですが、AndroidはタップしてもEntryにフォーカスが当たってくれません。
一度ListViewのEntryにフォーカスを当てた状態で、TableView内のEntryをタップすると動作するのですが、
スクロールや、Cellの外枠を触れてEntryからフォーカスを失うと、再度TableView内のEntryをタップしてもフォーカスされません。
解決方法をご存知の方、助けていただけませんでしょうか。
ListTableTestPage.xaml
<?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ListViewTest.ListTableTestPage"> <StackLayout Padding="20"> <ListView HasUnevenRows="true" ItemsSource="{Binding TestList}"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Padding="20" BackgroundColor="Yellow"> <Label Text="ListView"/> <Entry BackgroundColor="Fuchsia" /> <TableView HasUnevenRows="true" BackgroundColor="Red"> <TableSection Title="TableView"> <ViewCell> <StackLayout > <Label Text="{Binding Text}" /> <Entry Text="{Binding Entry}" BackgroundColor="Green" /> <Editor Text="{Binding Editor}" BackgroundColor="Gray" /> </StackLayout> </ViewCell> </TableSection> </TableView> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView > </StackLayout> </ContentPage>
ListTableTestPage.xaml.cs
using Xamarin.Forms; namespace ListViewTest { public partial class ListTableTestPage : ContentPage { public ListTableTestPage() { InitializeComponent(); BindingContext = new ListTableTestViewModel(); } } }
ListTableTestViewModel.cs
using System; using System.Collections.ObjectModel; using Prism.Mvvm; namespace ListViewTest { public class ListTableTestViewModel: BindableBase { public ObservableCollection<ListItem> TestList { get; } = new ObservableCollection<ListItem>(); public ListTableTestViewModel() { for (int i = 0; i < 3; i++) { TestList.Add(new ListItem()); } } public class ListItem : BindableBase { public string Text { get; set; } = "入力してね"; public string Entry { get; set; } = "Entry"; public string Editor { get; set; } = "Editor"; } } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/22 01:22