Export (0) Print
Expand All

AnnotationService Class

Provides core services of the Microsoft Annotations Framework to manage and display user annotations.

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

public sealed class AnnotationService : DispatcherObject
You cannot directly create an instance of this class in XAML.

The following example shows how to create and start an AnnotationService. For the full sample, see DocumentViewer with Annotations XML-Store Sample.

// ------------------------ 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)
        _annotService.Disable();

    // 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.
    _annotService.Enable(_annotStore);
}// end:StartAnnotations()

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.Annotations.AnnotationService

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft