TextAnchor.BoundingStart Proprietà

Definizione

Ottiene la posizione iniziale dell'ancoraggio di testo.

public:
 property System::Windows::Documents::ContentPosition ^ BoundingStart { System::Windows::Documents::ContentPosition ^ get(); };
public System.Windows.Documents.ContentPosition BoundingStart { get; }
member this.BoundingStart : System.Windows.Documents.ContentPosition
Public ReadOnly Property BoundingStart As ContentPosition

Valore della proprietà

Posizione iniziale dell'ancoraggio di testo.

Esempio

Si consideri un'applicazione lettore di documenti semplice con un riquadro commenti. Il riquadro dei commenti potrebbe essere una casella di riepilogo che visualizza il testo di un elenco di annotazioni ancorate a un documento. Se l'utente seleziona un elemento nella casella di riepilogo, l'applicazione visualizza il paragrafo del documento a cui è ancorato l'oggetto annotazione corrispondente.

Nell'esempio seguente viene illustrato come implementare il gestore eventi di una casella di riepilogo di questo tipo che funge da riquadro dei 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

Vedi anche