【问题标题】:How can I reset clicks made while page loading如何重置页面加载时的点击次数
【发布时间】:2014-09-18 19:27:23
【问题描述】:

我有橱窗商店应用程序。我尝试导航到正在加载一段时间(几秒钟)的页面。该页面包含几张大图片,因此它会加载一段时间,尤其是在弱设备上。当我在页面加载时单击时出现问题 - 加载页面时将处理单击。如果用户在页面加载时单击按钮所在的位置,则会单击按钮。

如何关闭此功能?有没有办法在加载时重置点击?

【问题讨论】:

    标签: windows-store-apps windows-8.1


    【解决方案1】:

    可以通过更好的设计方法来解决此问题,而不是重置页面加载时的点击次数。

    在页面加载时,显示一个不确定的进度条,一旦图像加载完成,隐藏进度条并显示您的实际屏幕。

    下面是一个示例,通过将进度条放在 PopUp 控件中来实现此目的 navigationHelper_LoadState(object sender, LoadStateEventArgs e) 事件

            //Progress Bar
            ProgressBar bar = new ProgressBar();
            bar.IsIndeterminate = true;
    
            //Downloading Data text
            TextBlock txt = new TextBlock();
            txt.Text = "Downloading data...";
            txt.FontSize = 17;
            txt.Foreground = new SolidColorBrush(Colors.White);
            txt.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
    
            //This could take a few seconds
            TextBlock txt2 = new TextBlock();
            txt2.Text = "This could take a few seconds.";
            txt2.FontSize = 17;
            txt2.Foreground = new SolidColorBrush(Colors.White);
            txt2.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
    
            //Please do not close the application.
            TextBlock txt3 = new TextBlock();
            txt3.Text = "Please do not close the application.";
            txt3.FontSize = 17;
            txt3.Foreground = new SolidColorBrush(Colors.White);
            txt3.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
    
            StackPanel stk = new StackPanel();
            stk.Children.Add(bar);
            stk.Children.Add(txt);
            stk.Children.Add(txt2);
            stk.Children.Add(txt3);
    
            stk.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            Grid contentGrid = new Grid();
            contentGrid.Height = Window.Current.Bounds.Height;
            contentGrid.Width = Window.Current.Bounds.Width;
            // or from LayoutGrid
            //contentGrid.Height = LayoutRoot.ActualHeight;
            //contentGrid.Width = LayoutRoot.ActualWidth;
            contentGrid.Width -= 40; // it seems that ContentDialog has some defaul margin
            contentGrid.Children.Add(stk);
    
            Popup dlg = new Popup();
            dlg.Child = contentGrid;
            SolidColorBrush color = new SolidColorBrush(Colors.Black);
            color.Opacity = 0.7;
            //dlg.Background = color;
            dlg.IsOpen = true;
    

    加载图片后,您可以选择关闭此弹出窗口

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-25
      • 2022-11-10
      • 2013-06-02
      • 2019-11-02
      • 1970-01-01
      • 2018-01-23
      • 1970-01-01
      相关资源
      最近更新 更多