Condividi tramite


IAnchorInfo.ResolvedAnchor Proprietà

Definizione

Ottiene l'oggetto che rappresenta il percorso nella struttura ad albero dove Anchor è risolto.

public:
 property System::Object ^ ResolvedAnchor { System::Object ^ get(); };
public object ResolvedAnchor { get; }
member this.ResolvedAnchor : obj
Public ReadOnly Property ResolvedAnchor As Object

Valore della proprietà

Object

L'oggetto che rappresenta il percorso nella struttura ad albero dove Anchor è risolto. Il tipo viene specificato dal tipo di oggetto annotato. Sticky Notes ed evidenziazione in documenti dinamici o statici vengono risolti sempre in un oggetto TextAnchor.

Esempio

Prendere in considerazione un'applicazione di lettura documenti semplice con un riquadro commenti. Il riquadro dei commenti potrebbe essere una casella di riepilogo in cui viene visualizzato il testo di un elenco di annotazioni ancorate a un documento. Se l'utente seleziona un elemento della casella di riepilogo, nell'applicazione viene visualizzato il paragrafo del documento a cui è ancorato l'oggetto di annotazione corrispondente.

Nell'esempio seguente viene illustrato come implementare il gestore eventi di tale casella di riepilogo che funge da riquadro commenti:

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();
    }
}
Private Sub annotationsListBox_SelectionChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)

    Dim comment As Annotation = TryCast((TryCast(sender, ListBox)).SelectedItem, Annotation)
    If comment IsNot Nothing Then
        ' service is an AnnotationService object
        ' comment is an Annotation object
        info = AnnotationHelper.GetAnchorInfo(Me.service, comment)
        Dim resolvedAnchor As TextAnchor = TryCast(info.ResolvedAnchor, TextAnchor)
        Dim textPointer As TextPointer = CType(resolvedAnchor.BoundingStart, TextPointer)
        textPointer.Paragraph.BringIntoView()
    End If
End Sub

Si applica a