我有一个带有ItemTemplate的Xamarin.Forms ListView.ItemTemplate包含名为"myEntry"的条目控件.每次选择一个项目时,我都想将焦点设置到输入控件.在我的xaml.cs ListView_ItemSelected事件中,listView.FindByName("myEntry")方法始终返回null:
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var lv = sender as ListView;
if (lv != null)
{
var entry = lv.FindByName<Entry>("myEntry");
if (entry != null)
entry.Focus();
}
}
Run Code Online (Sandbox Code Playgroud)
XAML:
<ListView ItemsSource="{Binding ArtikelListe}"
Header=""
HasUnevenRows="True"
ItemSelected="ListView_ItemSelected"
ItemTapped="ListView_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250*"/>
<ColumnDefinition Width="150*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="75*"/>
<ColumnDefinition Width="75*"/>
<ColumnDefinition Width="250*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Text="{Binding Bezeichnung}"/>
<Label Grid.Column="1" Text="{Binding ArtikelNr}"/>
<Label Grid.Column="2" Text="{Binding KatalogNr}"/>
<Label Grid.Column="3" …Run Code Online (Sandbox Code Playgroud) 我想在带有数字键盘的 Xamarin Forms 条目中使用逗号作为小数点分隔符。我将 Culture 设置为CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE");并且,显示在键盘上,但该条目仅接受.作为分隔符,并且仅当我使用电话键盘时才有效。这似乎是一个Andoid Bug。Xamarin Forms 有解决方案吗?