I have a ListView in my project with some elements nested in a Grid inside the ViewCell. One of them is a Entry:
<ListView x:Name="NotasListView" ItemsSource="{Binding Avaliacoes}"
HasUnevenRows="True"
IsRefreshing="{Binding Source={x:Reference NotasView}, Path=IsBusy}}" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid Padding="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" x:Name="lblOrdem" Text="{Binding ORDEM}" FontSize="12" Margin="1,5" TextColor="{Binding Cor}"></Label>
<Label Grid.Column="1" x:Name="lblMatricula" Text="{Binding MATRICULA}" FontSize="12" Margin="7,5" TextColor="{Binding Cor}"></Label>
<StackLayout Grid.Column="2">
<Label x:Name="lblNome" Text="{Binding NOME}" FontSize="12" Margin="6,1" TextColor="{Binding Cor}"></Label>
<Label x:Name="lblSituacao" Text="{Binding DescricaoSituacao}" FontSize="12" Margin="6,1" TextColor="{Binding Cor}" IsVisible="{Binding IsVisible}"></Label>
</StackLayout>
<Entry Grid.Column="3" Keyboard="Numeric" x:Name="txtNota" FontAttributes="Bold"
HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center"
Margin="7,1" FontSize="14"
Text="{Binding NOTA}"
IsEnabled="{Binding IsEnabled}"
Completed="txtNota_Completed">
<Entry.Behaviors>
<behavior:NotaBehavior x:Name="NotaBehavior" />
</Entry.Behaviors>
</Entry>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
As you can see, the list content is dynamic. Is there some way to change programmatically the focus to the next Entry on Completed event?
You could find all the entry in the listview, get the index of the current and then set the focus to the next entry. I use the AutomationId to get the index.
Xaml:
Code behind: