Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StickyNoteControl Class

Represents a control that lets users attach typed text or handwritten annotations to documents. This class cannot be inherited.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[TemplatePartAttribute(Name="PART_ContentControl", Type=typeof(ContentControl))] 
[TemplatePartAttribute(Name="PART_CloseButton", Type=typeof(Button))] 
[TemplatePartAttribute(Name="PART_ResizeBottomRightThumb", Type=typeof(Thumb))] 
[TemplatePartAttribute(Name="PART_IconButton", Type=typeof(Button))] 
[TemplatePartAttribute(Name="PART_CopyMenuItem", Type=typeof(MenuItem))] 
[TemplatePartAttribute(Name="PART_TitleThumb", Type=typeof(Thumb))] 
[TemplatePartAttribute(Name="PART_PasteMenuItem", Type=typeof(MenuItem))] 
[TemplatePartAttribute(Name="PART_InkMenuItem", Type=typeof(MenuItem))] 
[TemplatePartAttribute(Name="PART_SelectMenuItem", Type=typeof(MenuItem))] 
[TemplatePartAttribute(Name="PART_EraseMenuItem", Type=typeof(MenuItem))] 
public sealed class StickyNoteControl : Control
/** @attribute TemplatePartAttribute(Name="PART_ContentControl", Type=System.Windows.Controls.ContentControl) */ 
/** @attribute TemplatePartAttribute(Name="PART_CloseButton", Type=System.Windows.Controls.Button) */ 
/** @attribute TemplatePartAttribute(Name="PART_ResizeBottomRightThumb", Type=System.Windows.Controls.Primitives.Thumb) */ 
/** @attribute TemplatePartAttribute(Name="PART_IconButton", Type=System.Windows.Controls.Button) */ 
/** @attribute TemplatePartAttribute(Name="PART_CopyMenuItem", Type=System.Windows.Controls.MenuItem) */ 
/** @attribute TemplatePartAttribute(Name="PART_TitleThumb", Type=System.Windows.Controls.Primitives.Thumb) */ 
/** @attribute TemplatePartAttribute(Name="PART_PasteMenuItem", Type=System.Windows.Controls.MenuItem) */ 
/** @attribute TemplatePartAttribute(Name="PART_InkMenuItem", Type=System.Windows.Controls.MenuItem) */ 
/** @attribute TemplatePartAttribute(Name="PART_SelectMenuItem", Type=System.Windows.Controls.MenuItem) */ 
/** @attribute TemplatePartAttribute(Name="PART_EraseMenuItem", Type=System.Windows.Controls.MenuItem) */ 
public final class StickyNoteControl extends Control
TemplatePartAttribute(Name="PART_ContentControl", Type=System.Windows.Controls.ContentControl) 
TemplatePartAttribute(Name="PART_CloseButton", Type=System.Windows.Controls.Button) 
TemplatePartAttribute(Name="PART_ResizeBottomRightThumb", Type=System.Windows.Controls.Primitives.Thumb) 
TemplatePartAttribute(Name="PART_IconButton", Type=System.Windows.Controls.Button) 
TemplatePartAttribute(Name="PART_CopyMenuItem", Type=System.Windows.Controls.MenuItem) 
TemplatePartAttribute(Name="PART_TitleThumb", Type=System.Windows.Controls.Primitives.Thumb) 
TemplatePartAttribute(Name="PART_PasteMenuItem", Type=System.Windows.Controls.MenuItem) 
TemplatePartAttribute(Name="PART_InkMenuItem", Type=System.Windows.Controls.MenuItem) 
TemplatePartAttribute(Name="PART_SelectMenuItem", Type=System.Windows.Controls.MenuItem) 
TemplatePartAttribute(Name="PART_EraseMenuItem", Type=System.Windows.Controls.MenuItem) 
public final class StickyNoteControl extends Control
You cannot use this managed 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.

A text sticky note.

  • 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.

A free drawn ("ink") sticky note.

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2014 Microsoft