:: Home

  login:         
  passwords:  

WPF FAQs

WPF General Questions
Concepts Element Tree
Concepts Dependency Property
Concepts Attached Property
Concepts Routed Events
Concepts Resources.
Concepts Animation
Concepts Freezable Object
Concepts Input and Commands.
Concepts Layouts
XAML Inline Styles and Templates
XAML XML Namespaces
XAML Code Behind
XAML Custom Class
XAML Type Converters
Content Model ItemControl
Content Model HeaderedItemsControl
Content Model HeaderedContentControl
Content Model Content Control
Content Model Decorator Content Model
Content Model Panel Content Model
Documents Serialization and Storage
Documents Annotations
Documents Flow Content
Documents Printing
Graphics and Multimedia Rendering Graphics
Graphics and Multimedia Animation and Timing
Graphics and Multimedia 2D Graphics
Graphics and Multimedia 3D Graphics
Graphics and Multimedia Visual Layer
Control Customization Adorners
Control Customization Stylable controls
Control Customization ControlTemplates
Data Data Binding
Data DragandDrop
Data Serialization
Globalization and Localization Attributes
Globalization and Localization Comments
Globalization and Localization Globalization Struc
Application and Deployment ClickOnce
Application and Deployment Frame
Application and Deployment Page
Application and Deployment Navigation
Application and Deployment Setup
Application and Deployment Window
Interoperability Message Loops Between
Interoperability Win32 in WPF
Interoperability WPF in Win32
Interoperability Windows Forms and WPF
Security Trusted Security
Security Partial Trust Security
Tools Microsoft Expression Blend
Tools ZAM3D
Tools XAMLPAD
Controls ToolTip
Controls TextBlock
Controls TabControl
Controls ProgressBar
Controls PrintDialog
Controls Popup
Controls TextBox
Controls Canvas
Controls ComboBox
Controls ListBox
Controls StatusBar
Controls ToolBar
Controls Context Menu
Controls Expander
Controls DocumentViewer
Controls FlowDocumentReader
Controls GroupBox
Controls GridSplitter
Controls Image
Controls Menu
Controls ScrollBar
Controls Slider
Controls RichTextBox
Controls Border
Controls Buttons

SilverLight Interview Qs

SAP Interview Questions

Oracle Interview Questions

PHP Interview Questions

Ajax Interview Questions

IIS 7.0

OOP Interview Questions

Ruby Interview Questions

Sql Server Interview Questions

Winforms Interview Questions

SharePoint 2007 Questions

Microsoft Crm Questions

Documents Annotations Interview Questions & FAQs

Questions and answers for Documents Annotations.

23. Documents Annotations

    23.1 How can I Match Annotations with Annotated Objects ?
    23.2 How can I create an application that is used to declare a Context Menu with routed commands that the users can access to create and manage annotations ?

23.1 How can I Match Annotations with Annotated Objects ?

You can match annotations with the corresponding annotated objects. For example, consider a simple document reader application that has a comments pane. The comments pane might be a listbox that displays the text from a list of annotations that are anchored to a document. If the user selects an item in the listbox, then the application brings into view the paragraph in the document that the corresponding annotation object is anchored to.

The following piece of C # code demonstrates how to implement the event handler of such a listbox that serves as the comments pane.

[C#]

void annotationsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{

Annotation comment = (sender as ListBox).SelectedItem as Annotation;
if (comment != null)
{
// IAnchorInfo info;
// service is an AnnotationService object
// comment is an Annotation object


info = AnnotationHelper.GetAnchorInfo(this.service, comment);
TextAnchor resolvedAnchor = info.ResolvedAnchor as TextAnchor;
TextPointer textPointer = (TextPointer)resolvedAnchor.BoundingStart;
textPointer.Paragraph.BringIntoView();
}
}


23.2 How can I create an application that is used to declare a Context Menu with routed commands that the users can access to create and manage annotations ?

Users typically create annotations by first selecting some text or an item of interest and then right-clicking to display a context menu of annotation options.

The following example shows the XAML you can use to declare a Context Menu with routed commands that users can access to create and manage annotations.

[XAML]

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

bottom user control
::  Home :: Services ::  Prices ::  Request Quote
Copyright 2007, Megasolutions Ltd