Export (0) Print
Expand All
1 out of 5 rated this helpful - Rate this topic

StickyNoteControl Class

Represents a control that lets users attach typed text or handwritten annotations to documents.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
[TemplatePartAttribute(Name = L"PART_ContentControl", Type = typeof(ContentControl))]
[TemplatePartAttribute(Name = L"PART_CloseButton", Type = typeof(Button))]
[TemplatePartAttribute(Name = L"PART_ResizeBottomRightThumb", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = L"PART_IconButton", Type = typeof(Button))]
[TemplatePartAttribute(Name = L"PART_CopyMenuItem", Type = typeof(MenuItem))]
[TemplatePartAttribute(Name = L"PART_TitleThumb", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = L"PART_PasteMenuItem", Type = typeof(MenuItem))]
[TemplatePartAttribute(Name = L"PART_InkMenuItem", Type = typeof(MenuItem))]
[TemplatePartAttribute(Name = L"PART_SelectMenuItem", Type = typeof(MenuItem))]
[TemplatePartAttribute(Name = L"PART_EraseMenuItem", Type = typeof(MenuItem))]
public ref class StickyNoteControl sealed : public Control
You cannot directly create an instance of this class in XAML.

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 StickyNoteControl 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 StickyNoteControl 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 &amp; Notes" />
  </ContextMenu>
</DocumentViewer.ContextMenu>
System::Object
  System.Windows.Threading::DispatcherObject
    System.Windows::DependencyObject
      System.Windows.Media::Visual
        System.Windows::UIElement
          System.Windows::FrameworkElement
            System.Windows.Controls::Control
              System.Windows.Controls::StickyNoteControl
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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.