maui icon indicating copy to clipboard operation
maui copied to clipboard

[WinUI] Problems while using `RefreshView`

Open AndreasReitberger opened this issue 2 years ago • 3 comments

Description

I have problems to get the RefreshView control working on WinUI. I'm not able to click content which is nested in the RefreshView. Also, I cannot trigger the pull to refresh function.

image

The XAML code for the screenshot above:

<!-- Main Content -->
    <Grid
        RowSpacing="0"
        RowDefinitions="Auto,*,Auto"
        >
        <!-- Header -->
        <StackLayout      
                Padding="16,8"
                Spacing="0"
                CompressedLayout.IsHeadless="true"
                >
            <!-- Title  -->
            <Label
                    Margin="16,8"
                    FontFamily="{StaticResource MontserratSemiBold}"
                    Text="{x:Static localization:Strings.HeadlineOverview}"
                    TextColor="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray100}}"
                    HorizontalTextAlignment="Start" 
                    Style="{StaticResource HeadlineLabelStyle}"
                    />
            <BoxView />
        </StackLayout>

        <!-- KlipperState -->
        <RefreshView 
            Grid.Row="1"
            IsRefreshing="{Binding IsRefreshing}" 
            Command="{Binding RefreshPageCommand}"
            >
            <ScrollView>
                <StackLayout
                    Style="{StaticResource ModalInputPageStackLayoutStyle}"
                    >
                    <!-- ... -->
                </StackLayout>
            </ScrollView>
        </RefreshView>

        <!-- Tag line -->
        <StackLayout 
                IsVisible="{Binding IsPrinterOnline, Converter={StaticResource BooleanReverseVisibilityConverter}}"
                Grid.Row="2" 
                BackgroundColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray900}}"
                >
            <BoxView />
            <Button
                    Margin="20,6,20,4"
                    Command="{Binding RestartServiceCommand}"
                    CommandParameter="firmware"
                    Text="{x:Static localization:Strings.ButtonRestartFirmware}"
                    Style="{StaticResource RoundedLongButtonStyle}"
                    />
            <Button
                    Margin="20,4,20,20"
                    Command="{Binding RestartServiceCommand}"
                    CommandParameter="klipper"
                    Text="{x:Static localization:Strings.ButtonRestartKlipper}"
                    Style="{StaticResource RoundedLongButtonStyle}"
                    />
        </StackLayout>
    </Grid>
        public Command RefreshPageCommand { get; set; }
        bool RefreshPageCommand_CanExcecute()
        {
            return !IsRefreshing;
        }
        async Task RefreshPageAction()
        {
            try
            {
                IsRefreshing = true;
                List<Task> tasks = new()
                {
                    KlipperClient.Instance.RefreshPrintStatusAsync(),
                    KlipperClient.Instance.RefreshVirtualSdCardStatusAsync(),
                    KlipperClient.Instance.RefreshPrinterInfoAsync(),
                };
                await Task.WhenAll(tasks);
                KlipperState = KlipperClient.Instance.KlipperState;
                IsPrinterOnline = KlipperState == "ready";

                if (IsPrinterOnline)
                {
                    CachedTemperatures = await KlipperClient.Instance.GetServerCachedTemperatureDataAsync();
                    UpdateTemperatureHistory();
                }
            }
            catch (Exception exc)
            {
                // Log error
                EventManager.Instance.LogError(exc);
            }
            IsRefreshing = false;
        }

Steps to Reproduce

  1. Create a RefreshView and run the app on Windows

Version with bug

6.0.408 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

windows10.0.19041.0

Did you find any workaround?

No response

Relevant log output

No response

AndreasReitberger avatar Aug 07 '22 13:08 AndreasReitberger

Hi @AndreasReitberger. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Aug 08 '22 14:08 ghost

Hi, I created a repro. https://github.com/AndreasReitberger/MauiRefreshViewRepro

  1. Run on Windows
  2. Click on "Open Modal",
  3. Try to click the "Click me" button

After 10 seconds it works. This is the time spent on the "RefreshCommand". I guess that the problem is, that the Refresh animation is not shown at all. Hope this helps!

AndreasReitberger avatar Aug 09 '22 09:08 AndreasReitberger

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Aug 09 '22 18:08 ghost

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on windows platform with sample project. https://github.com/AndreasReitberger/MauiRefreshViewRepro image

homeyf avatar Jul 10 '23 03:07 homeyf

Still an issue as of 8.0-preview6. The swipe to pull-to-refresh was temporarily resolved as of preview3, but another solution will be necessary, as this breaks this Windows design guidelines.

samhouts avatar Jul 18 '23 22:07 samhouts

Still an issue as of 8.0-preview6. The swipe to pull-to-refresh was temporarily resolved as of preview3, but another solution will be necessary, as this breaks this Windows design guidelines.

RefreshContainer works only with touch, the recommendation working with mouse is to also have a refresh button. Feedback?, could we do something else at RefreshView level?

jsuarezruiz avatar Sep 18 '23 11:09 jsuarezruiz

@jsuarezruiz The real bug here appears to be that the RefreshView blocks all controls inside it. You can't click on buttons or anything anymore.

samhouts avatar Sep 18 '23 14:09 samhouts