This documentation is archived and is not being maintained.

AnnotationHelper.CreateInkStickyNoteForSelection Method

Creates an ink sticky note annotation on the current selection of the viewer control associated with the specified AnnotationService..

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

public static Annotation CreateInkStickyNoteForSelection(
	AnnotationService service,
	string author
You cannot use methods in XAML.


Type: System.Windows.Annotations.AnnotationService

The annotation service to use to create the ink sticky note annotation.

Type: System.String

The author of the annotation.

Return Value

Type: System.Windows.Annotations.Annotation
The ink sticky note annotation; or null, if there is no selected content to annotate.


service is null.


service is not enabled.


The viewer control contains no content selection.

The ink sticky note annotation is anchored to the content defined by the current selection of the DocumentViewerBase, DocumentViewer, FlowDocumentPageViewer, FlowDocumentScrollViewer, or FlowDocumentReader control specified to the AnnotationService constructor.

If there is no user-selected content (the selection length is zero length), no annotation is created and an InvalidOperationException is thrown.

author can be specified as null in which case no author is defined.

The given annotation service must be enabled by means of a call to AnnotationService.Enable prior to calling CreateInkStickyNoteForSelection.

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