Annotations Styling Sample

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This sample demonstrates how you can use styles to change the appearance and behavior of user annotation notes or highlights displayed with content in a document viewing control.

When executed, the sample displays a FlowDocument hosted in a FlowDocumentPageViewer control. To add an annotation, select some text and click "Text", "Ink", or one of the highlight colors on the menu bar. By selecting different options under the "StickyNote Style" combo box, you change the appearance and behavior of the text and ink sticky-note annotations.

This sample demonstrates how the styling operations are performed. The method of annotation styling shown here can also be used with other FlowDocument controls such as FlowDocumentReader and FlowDocumentScrollViewer, or with a FixedDocument or XpsDocument hosted in a DocumentViewer.

This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow application development best practices. For comprehensive coverage of WPF and Microsoft .NET Framework application development best practices, refer to the following as appropriate:

Accessibility - Accessibility Best Practices

Security - Windows Presentation Foundation Security

Localization - WPF Globalization and Localization Overview

Building the Sample

  • Install the Windows Software Development Kit (SDK) and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.

  • Download the sample, usually from the software development kit (SDK) documentation, to your hard disk drive.

  • To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.

  • To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.

Running the Sample

  • To run the compiled sample with debugging in Visual Studio, press F5.

  • To run the sample from a CMD Shell command window, execute the .exe file located in the source folder of the sample.

See Also

Tasks

DocumentViewer Styling Sample

DocumentViewer with Annotations XML-Store Sample

DocumentViewer with Annotations XPS-Store Sample

Introduction to Styling and Templating Sample

Reference

System.Windows.Annotations

Concepts

Annotations Overview

Documents in Windows Presentation Foundation

Styling and Templating

Data Templating Overview