I have an Android App in Xamarin Forms and in the app I have this buttons.
They all work perfectly, but the "cleanButtonPressed" method in the "btnClear" button have a little problem.
XAML:
<StackLayout VerticalOptions="EndAndExpand" HorizontalOptions="FillAndExpand" Orientation="Horizontal">
<Button x:Name="btnSaveStock" Text="Salva" VerticalOptions="End" HorizontalOptions="FillAndExpand" Clicked="btnSaveStock_Clicked" IsEnabled="False"></Button>
<Button x:Name="btnClear" Text="Pulisci" VerticalOptions="End" HorizontalOptions="FillAndExpand" Clicked="cleanButtonPressed" IsEnabled="False"></Button>
<Button x:Name="btnCloseList" Text="Chiudi lista" VerticalOptions="End" HorizontalOptions="FillAndExpand" Clicked="btnCloseList_Clicked"></Button>
</StackLayout>
When I press the button the method PulisciControlli() executes perfectly, and hits the breakpoint without any exception
But when I press F11 it generates immediately the exception.
PulisciControlli, if not called from this method, works perfectly. They are not present binding, resources dictionary... ecc in the XAML.
Thanks for the help!
EDIT:
PulisciControlli actually doing this:
private void PulisciControlli()
{
etyArticolo.Text = "";
etyGiacenza.Text = "";
etyRealGiacenza.Text = "";
etyArticolo.Text = "";
etyArticolo2.Text = "";
etyFornitore.Text = "";
matricolaSelezionata = null;
ubicazioneSelezionata = null;
pckUbicazioni.ItemsSource = null;
pckUbicazioni.IsVisible = false;
pckMatricole.ItemsSource = null;
pckMatricole.IsVisible = false;
etyArticolo2.IsEnabled = false;
etyFornitore.IsEnabled = false;
stcArticolo2.IsVisible = false;
stcFornitore.IsVisible = false;
stcOtherFields.IsVisible = false;
etyArticolo.Focus();
}