Export (0) Print
Expand All

AnnotationService Constructor (FlowDocumentScrollViewer)

Initializes a new instance of the AnnotationService class for use with a specified FlowDocumentScrollViewer control.

Namespace:  System.Windows.Annotations
Assembly:  PresentationFramework (in PresentationFramework.dll)

public AnnotationService(
	FlowDocumentScrollViewer viewer


Type: System.Windows.Controls.FlowDocumentScrollViewer

The document viewing control associated with the AnnotationService.


viewer is null.

The following example shows use of the AnnotationService constructor.

// ------------------------ StartAnnotations -------------------------- 
/// <summary> 
///   Enables annotations and displays all that are viewable.</summary> 
private void StartAnnotations()
    // If there is no AnnotationService yet, create one. 
    if (_annotService == null)
        // docViewer is a document viewing control named in Window1.xaml.
        _annotService = new AnnotationService(docViewer);

    // If the AnnotationService is currently enabled, disable it. 
    if (_annotService.IsEnabled == true)

    // Open a stream to the file for storing annotations.
    _annotStream = new FileStream(
        _annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);

    // Create an AnnotationStore using the file stream.
    _annotStore = new XmlStreamStore(_annotStream);

    // Enable the AnnotationService using the new store.
}// end:StartAnnotations()

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft