Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 4
 NavigationProgress Event
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2010/.NET Framework 4

Other versions are also available for the following:
.NET Framework Class Library
NavigationService..::.NavigationProgress Event

Occurs periodically during a download to provide navigation progress information.

Namespace:  System.Windows.Navigation
Assembly:  PresentationFramework (in PresentationFramework.dll)
Visual Basic
Public Event NavigationProgress As NavigationProgressEventHandler
C#
public event NavigationProgressEventHandler NavigationProgress
Visual C++
public:
 event NavigationProgressEventHandler^ NavigationProgress {
    void add (NavigationProgressEventHandler^ value);
    void remove (NavigationProgressEventHandler^ value);
}
F#
member NavigationProgress : IEvent<NavigationProgressEventHandler,
    NavigationProgressEventArgs>

NavigationProgress is passed a NavigationProgressEventArgs which exposes the following progress information:

  • Number of bytes downloaded so far (BytesRead).

  • Number of total bytes to download (MaxBytes).

NavigationProgress is raised once for every 1024 bytes of content downloaded, and once more if the number of remaining bytes is ever less than 1024 bytes. For this reason, handling NavigationProgress provides a useful way to track and display the progress of a current download.

NavigationProgress won't be raised in some cases, such as when the same piece of content is navigated to, or when a content fragment is navigated to on content that is currently loaded (that is, the value of the Content property).

When navigating to a compiled XAML resource, the final NavigationProgress event may not be raised. This means that at the end of the download, the last reported BytesRead value may not equal the MaxBytes value. Handle the LoadCompleted event to be notified when the navigation has finished.

NoteNote

When NavigationService raises NavigationProgress, it also raises Application..::.NavigationProgress event on the Application object.

The following example shows how to handle NavigationProgress.

Visual Basic
Private Sub NavigationService_NavigationProgress(ByVal sender As Object, ByVal e As NavigationProgressEventArgs)
    Dim msg As String = String.Format("{0} of {1} bytes retrieved.", e.BytesRead, e.MaxBytes)
    Me.progressStatusBarItem.Content = msg
End Sub
C#
void NavigationService_NavigationProgress(object sender, NavigationProgressEventArgs e)
{
    string msg = string.Format("{0} of {1} bytes retrieved.", e.BytesRead, e.MaxBytes);
    this.progressStatusBarItem.Content = msg;
}

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker