RelativeSource Costruttori

Definizione

Inizializza una nuova istanza della classe RelativeSource.

Overload

Nome Descrizione
RelativeSource()

Inizializza una nuova istanza della classe RelativeSource.

RelativeSource(RelativeSourceMode)

Inizializza una nuova istanza della RelativeSource classe con una modalità iniziale.

RelativeSource(RelativeSourceMode, Type, Int32)

Inizializza una nuova istanza della RelativeSource classe con una modalità iniziale e altri qualificatori a piedi ad albero per trovare l'origine relativa desiderata.

RelativeSource()

Inizializza una nuova istanza della classe RelativeSource.

public:
 RelativeSource();
public RelativeSource();
Public Sub New ()

Si applica a

RelativeSource(RelativeSourceMode)

Inizializza una nuova istanza della RelativeSource classe con una modalità iniziale.

public:
 RelativeSource(System::Windows::Data::RelativeSourceMode mode);
public RelativeSource(System.Windows.Data.RelativeSourceMode mode);
new System.Windows.Data.RelativeSource : System.Windows.Data.RelativeSourceMode -> System.Windows.Data.RelativeSource
Public Sub New (mode As RelativeSourceMode)

Parametri

mode
RelativeSourceMode

Uno dei RelativeSourceMode valori.

Si applica a

RelativeSource(RelativeSourceMode, Type, Int32)

Inizializza una nuova istanza della RelativeSource classe con una modalità iniziale e altri qualificatori a piedi ad albero per trovare l'origine relativa desiderata.

public:
 RelativeSource(System::Windows::Data::RelativeSourceMode mode, Type ^ ancestorType, int ancestorLevel);
public RelativeSource(System.Windows.Data.RelativeSourceMode mode, Type ancestorType, int ancestorLevel);
new System.Windows.Data.RelativeSource : System.Windows.Data.RelativeSourceMode * Type * int -> System.Windows.Data.RelativeSource
Public Sub New (mode As RelativeSourceMode, ancestorType As Type, ancestorLevel As Integer)

Parametri

mode
RelativeSourceMode

Uno dei RelativeSourceMode valori. Affinché questa firma sia rilevante, deve essere FindAncestor.

ancestorType
Type

Oggetto Type del predecessore da cercare.

ancestorLevel
Int32

Posizione ordinale del predecessore desiderato tra tutti i predecessori del tipo specificato.

Esempio

Di seguito viene restituito il secondo ItemsControl rilevato sul percorso verso l'alto a partire dall'elemento di destinazione dell'associazione.

Binding myBinding = new Binding();
// Returns the second ItemsControl encountered on the upward path
// starting at the target element of the binding
myBinding.RelativeSource = new RelativeSource(
    RelativeSourceMode.FindAncestor, typeof(ItemsControl), 2);
Dim myBinding As New Binding()
' Returns the second ItemsControl encountered on the upward path
' starting at the target element of the binding
myBinding.RelativeSource = New RelativeSource(RelativeSourceMode.FindAncestor, GetType(ItemsControl), 2)

Commenti

ancestorType e ancestorLevel non hanno rilevanza se specificati come parametri per un oggetto mode diverso da FindAncestor. Non utilizzare questa firma per gli altri RelativeSourceMode valori.

Si applica a