如何在 WP8 WebBrowser 控件加载 URL 之前显示进度条?

编程入门 行业动态 更新时间:2024-10-25 11:20:26
本文介绍了如何在 WP8 WebBrowser 控件加载 URL 之前显示进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个 WebBrowser 控件,我想在这个控件上显示一些 url.在浏览器加载页面之前,我需要显示一些进度条或动画.

I have a WebBrowser control and I want to show some url on this control. Until the webbrower loaded the page, I need to show some progressbar or animation.

请帮助我,这是我所拥有的:

Please help me, here's what I have:

XAML:

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <ProgressBar x:Name="progressbar" IsIndeterminate="True"/>
    <phone:WebBrowser x:Name="webbrw" IsScriptEnabled="True"/>
</Grid>

强文本

public MainPage()
{
    InitializeComponent();

    // Sample code to localize the ApplicationBar
    //BuildLocalizedApplicationBar();
    Loaded += MainPage_Loaded;
}

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    webbrw.LoadCompleted += webbrw_LoadCompleted;
    webbrw.Source = new Uri("http://www.youtube/user/tseries");
}

void webbrw_LoadCompleted(object sender, NavigationEventArgs e)
{
    progressbar.IsIndeterminate = false;
}

推荐答案

如果您只是想在加载页面时显示栏并在之后隐藏它,您'重新使用错误的属性.IsIndeterminate 属性报告通用进程 (true) 或基于值 (false) 的进程.要隐藏您应该使用的进度条:

If you simply want to show the bar while loading the page and hide it afterwards, you're using the wrong property. The IsIndeterminate property reports a generic process (true) or one based on a value (false). To hide the progressbar you should use:

progressbar.Visibility = Visibility.Collapsed; 

这篇关于如何在 WP8 WebBrowser 控件加载 URL 之前显示进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:20:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117503.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   进度条   加载   如何在   WebBrowser

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!