I have a entry with complete action:<local:BaseEntry Placeholder="Email Address" Keyboard="Email" x:Name="EmailEntry" ReturnType="Next" Completed="{Binding GoToPassword}"/>
I want to focus to the next entry when user press done button from keyboard.
So how to perform Completed action from ViewModel?
Answers
Completed is an event
https://developer.xamarin.com/api/event/Xamarin.Forms.Entry.Completed/
If you want use an Event inside a ViewModel you should use Behaviors
https://blog.xamarin.com/turn-events-into-commands-with-behaviors/
@AlessandroCaliaro
And how to Access entry IsVisible property inside View Model?
It's a property... with a simple Binding
@Harshita here you go
i made a mistake, as i have copied the code. the ListView.Behaviors must be change to Entry.Behaviors
Maybe you can use this way from your constructor method in your cs class, after of the InitializeComponent():
EmailEntry.Completed += (sender, e) =>
{
PasswordEntry.Focus();
};
This will fire the Completed event when you press enter (or done) on EmailEntry.
MG
saved my life. thank u sir.
Protip:
Somewhere you have to detach the behavior or the page isn't released from memory
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/behaviors/creating
"In addition, note that behaviors are not implicitly removed from controls when pages are popped from the navigation stack. Instead, they must be explicitly removed prior to pages going out of scope."
Sorry for late response, but i tried to run your code with minimum changes, but in Bindable_Completed Command is always passing as null, can you please help with this issue?