MAUI - Entry - Automaticly Jump to net Entry Field on maxlenght

Viewed 84

I have 2 maui entry controls that have a maxLenght.

When filling in the first entry control , I would like it to automaticly jump to the next control whenever all values are filled in.

Can not seem to find any info on that.

Any suggestions ?

Thanks,

1 Answers

Xaml:

<Entry
    x:Name="Entry1"
    MaxLength="5"
    TextChanged="Entry1_TextChanged"
    />

<Entry
    x:Name="Entry2"
    MaxLength="5"
    />

Code behind:

private void Entry1_TextChanged(object sender, TextChangedEventArgs e)
{
    if (e.NewTextValue.Length == Entry1.MaxLength)
    {
        Entry2.Focus();
    }
}

Explanation:

You define an event triggered by a change of Text in the first Entry. When the text reach the maximum length you set, the second Entry is focused.

Related