Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ImageButton Source Binding problem

$
0
0

Hi

I am using Image Button with this code:

        ImageButton imageButtonStampa = new ImageButton() { Style = (Style)Application.Current.Resources["imageButtonStyle"] };
        imageButtonStampa.SetBinding(ImageButton.CommandProperty, "StampaCommand");
        imageButtonStampa.SetBinding(ImageButton.IsEnabledProperty, new Binding("NewBarcode", converter: new IsNotNullToBooleanConverter()));
        imageButtonStampa.SetBinding(ImageButton.SourceProperty, new Binding("NewBarcode", converter: new IsNotNullToSourceConverter(), converterParameter: stampaSources));

First time I open the page I have this:

Then I insert some data, IsNotNullToSourceConverter fires and Source changes:

Now, when I press the ImageButton, I send some data to a bluetooth printer.

        StampaCommand = new Command(async () => {
            try
            {

                if (_isTapped)
                    return;

                _isTapped = true;

                await Util.Print.PrintBarcode(Preferences.GetPrinterBarcode(), NewBarcode);

                _isTapped = false;
            }
            catch (Exception ex)
            {
                _isTapped = false;
                await Application.Current.MainPage.DisplayAlert(AppResources.Attenzione, ex.Message, AppResources.Ok);
            }
        });

But I have this problem:

and when print is finished, the problem remains:

If I rotate the screen, problem disappears:

What can I do for this?

@DavidOrtinau

Thanks
Alessandro


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>