How to add ActivityIndicator to shell flyout

Viewed 284

I added a logout button to the FlyoutFooter of the shell. After clicking it, it takes a certain waiting time to connect to the server, so I need to add an ActivityIndicator in the flyout.

  <Shell.FlyoutFooter>
        <Grid>
            <Button Text="Logout"
                    Clicked="Button_Clicked"/>
        </Grid>
    </Shell.FlyoutFooter>

How can I add it there?

1 Answers

You can use FlyoutContent property:

   <Shell.FlyoutFooter>
        <Grid>
            <Button Text="Logout"
                    Clicked="Button_Clicked"/>
        </Grid>
    </Shell.FlyoutFooter>
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var grid = new Grid();
            grid.Children.Add(new ActivityIndicator()
            {
                IsRunning = true,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            });

            Current.FlyoutContent = grid;
            await Task.Delay(5000);
            FlyoutContent = null;
        }

enter image description here enter image description here

Related