You can know if the button is clicked by checking the "ispressed"
Here is my sample code you can refer to:
xmal:
<ContentPage.Content>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Entry x:Name="myentry" Unfocused="E_UFEvent"/>
<Button x:Name="mybutton" Clicked="Onbutton_Clicked" Text="Click me"/>
</StackLayout>
</ContentPage.Content>
codebehind:
void E_UFEvent(Object sender, EventArgs e)
{if (mybutton.IsPressed)
{
DisplayAlert("Notice", "Fired after button clicked","ok");
}
Update:
You can set a flag, excute the method when it's true, and delay the unfoucused event to check if the button is cliked(set flag to false when button cliked), and change flag back when then etry is focused agagin.code as following:
xmal:
<ContentPage.Content>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Entry x:Name="myentry" Unfocused="E_UFEvent" Focused="E_FEvent"/>
<Button x:Name="mybutton" Pressed="OnButton_Pressed" Text="Click me"/>
</StackLayout>
</ContentPage.Content>
codebehind:
private Boolean IsExcute;
async void E_UFEvent(Object sender, EventArgs e)
{await Task.Delay(2000);
if (IsExcute)
{
//do something
}
void E_FEvent(Object sender, EventArgs e)
{IsExcute=true;}
void On_ButtonPressed(Object sender, EventArgs e)
{IsExcute=false;}