Rg.Plugins.Popup icon indicating copy to clipboard operation
Rg.Plugins.Popup copied to clipboard

Weird UI issue when having two ScrollViews in popup page with some data binding.

Open SRadeon opened this issue 5 years ago • 0 comments

🐛 Bug Report

So this is a weird one.

PopupView.xaml

            <StackLayout>
                <Button Text="Test" Command="{Binding ButtonCommand }"/>
                <Label Text="{Binding Text}"/>
                <ScrollView/>
                <ScrollView/>
            </StackLayout>

PopupViewModel.cs

    public string Text
    {
        get => text;
        protected set
        {
            SetProperty(ref text, value);
            OnPropertyChanged(nameof(ButtonCommand));
        }
    }

    public Command ButtonCommand => new Command(
            async () => await ButtonCommandAsync(), () => Text == "0");

    protected async Task ButtonCommandAsync()
    {
        Text = "1";
        await Task.Delay(500);
        Text = "2";
        await Task.Delay(500);
        Text = "3";
        await Task.Delay(500);
        Text = "4";
        await Task.Delay(500);
        Text = "0";
    }

The code after await will not be executed until you jiggle the mouse. So to complete ButtonCommandAsync you need to jiggle the mouse 4 times. To clarify, the jiggle will be required once the ButtonCommand can execute evaluates to false. So changing the can execute condition to Text != "2" will require a jiggle between Text = 2 and Text = 3.

Additional weirdness:

  1. Removing the second ScrollView fixes the issue.
  2. Keeping two ScrollViews and adding an empty button <Button/> fixes the issue.

Note, this happens only in PopupPage. The same code works just fine in a regular ContentPage.

Expected behavior

Command executes correctly without the need to jiggle the mouse.

Reproduction steps

Use the attached minimal project. This is a blank XF UWP app with the additional PopupView and PopupViewModel.

The project use the following versions, but older versions exhibit similar behavior: Rg.Plugins.Popup 2.0.0.2 Xamarin.Forms 4.5.0.657 Xamarin.Essentials 1.5.3.1

UwpPopupTest.zip

Platform:

  • [x] :earth_americas: UWP
  • [x] :monkey: Xamarin.Forms

SRadeon avatar Apr 24 '20 17:04 SRadeon