3

我在 shell 中添加了一个注销按钮FlyoutFooter。点击后,需要一定的等待时间才能连接到服务器,所以我需要ActivityIndicator在弹出窗口中添加一个。

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

我怎样才能在那里添加它?

4

1 回答 1

1

您可以使用FlyoutContent属性:

   <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;
        }

在此处输入图像描述 在此处输入图像描述

于 2021-02-03T13:46:47.947 回答