Edytuj

Udostępnij za pośrednictwem


AnnotationHelper.CreateTextStickyNoteForSelection Method

Definition

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

public:
 static System::Windows::Annotations::Annotation ^ CreateTextStickyNoteForSelection(System::Windows::Annotations::AnnotationService ^ service, System::String ^ author);
public static System.Windows.Annotations.Annotation CreateTextStickyNoteForSelection (System.Windows.Annotations.AnnotationService service, string author);
static member CreateTextStickyNoteForSelection : System.Windows.Annotations.AnnotationService * string -> System.Windows.Annotations.Annotation
Public Shared Function CreateTextStickyNoteForSelection (service As AnnotationService, author As String) As Annotation

Parameters

service
AnnotationService

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

author
String

The author of the annotation.

Returns

The text sticky note annotation; or null, if there is no selected content to annotate.

Exceptions

service is null.

service is not enabled.

The viewer control contains no content selection.

Remarks

The text 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 CreateTextStickyNoteForSelection.

Applies to

See also