Represents a control that lets users attach typed text or handwritten annotations to documents.
Assembly: PresentationFramework (in PresentationFramework.dll)
A sticky note provides a rectangular area whose content is separate from the text, image, or other material to which the note is anchored.
The class and its members are public so that it can be styled, but is no public constructor. Instances are created with the CreateTextStickyNoteCommand and CreateInkStickyNoteCommand of the AnnotationService class.
When a sticky note is created, it is designated as one of two types:
Text sticky notes have a RichTextBox content area that can be written and edited like any other Rich Text area. Users can type into it and can also cut, copy, and paste both within the note and between the note and other applications. Images can also be pasted into the note. The usual Rich Text keyboard shortcuts are also available.
Ink sticky notes have an InkCanvas content area and it can be edited like other ink canvasses. For example, strokes can be erased. With a tablet PC or other suitable hardware, users can enter handwritten notes.
The user interface (UI) of the makes it a more powerful way to annotate material than marking up a hardcopy or using physical handwritten notes. It is also more flexible than simply adding to, or striking through, the text of a document.
Sticky notes can be resized.
Sticky notes can be minimized to an icon and expanded.
When maximized, a sticky note can be dragged to a new position in a window without changing the location of its anchor.
The exact content to which a sticky note applies is highlighted and marked off with brackets.
Two or more sticky notes can apply to the same content or to overlapping content.
When change occurs within the document content to which a sticky note is anchored, the sticky note's position moves in position relative to the content to which it was bound.
With text sticky notes, lines will wrap automatically. If the note is resized, lines will re-wrap as needed. If content extends below the bottom of the note, a vertical scroll bar will appear.
With ink sticky notes, vertical and horizontal scroll bars will appear whenever content extends beyond the boundaries of the note.
The following example shows how menu commands in a DocumentViewer can be configured to execute the CreateTextStickyNoteCommand and CreateInkStickyNoteCommand of the AnnotationService class. For the full example see DocumentViewer with Annotations XPS-Store Sample. The example shows how to read an XML Paper Specification (XPS) document into a DocumentViewer control and then enable support for adding user-created sticky notes.
<DocumentViewer.ContextMenu> <ContextMenu> <MenuItem Command="ApplicationCommands.Copy" /> <Separator /> <!-- Add a Highlight annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateHighlightCommand" Header="Add Highlight" /> <!-- Add a Text Note annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateTextStickyNoteCommand" Header="Add Text Note" /> <!-- Add an Ink Note annotation to a user selection. --> <MenuItem Command="ann:AnnotationService.CreateInkStickyNoteCommand" Header="Add Ink Note" /> <Separator /> <!-- Remove Highlights from a user selection. --> <MenuItem Command="ann:AnnotationService.ClearHighlightsCommand" Header="Remove Highlights" /> <!-- Remove Text Notes and Ink Notes from a user selection. --> <MenuItem Command="ann:AnnotationService.DeleteStickyNotesCommand" Header="Remove Notes" /> <!-- Remove Highlights, Text Notes, Ink Notes from a selection. --> <MenuItem Command="ann:AnnotationService.DeleteAnnotationsCommand" Header="Remove Highlights & Notes" /> </ContextMenu> </DocumentViewer.ContextMenu>
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.