RelativeSource Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy RelativeSource.

Przeciążenia

RelativeSource()

Inicjuje nowe wystąpienie klasy RelativeSource.

RelativeSource(RelativeSourceMode)

Inicjuje RelativeSource nowe wystąpienie klasy w trybie początkowym.

RelativeSource(RelativeSourceMode, Type, Int32)

Inicjuje nowe wystąpienie RelativeSource klasy z trybem początkowym i dodatkowymi kwalifikatorami chodzenia drzewami w celu znalezienia żądanego względnego źródła.

RelativeSource()

Inicjuje nowe wystąpienie klasy RelativeSource.

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

Dotyczy

RelativeSource(RelativeSourceMode)

Inicjuje RelativeSource nowe wystąpienie klasy w trybie początkowym.

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)

Parametry

mode
RelativeSourceMode

RelativeSourceMode Jedna z wartości.

Dotyczy

RelativeSource(RelativeSourceMode, Type, Int32)

Inicjuje nowe wystąpienie RelativeSource klasy z trybem początkowym i dodatkowymi kwalifikatorami chodzenia drzewami w celu znalezienia żądanego względnego źródła.

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)

Parametry

mode
RelativeSourceMode

RelativeSourceMode Jedna z wartości. Aby ten podpis był odpowiedni, powinien to być FindAncestor.

ancestorType
Type

Element Type przodka do wyszukania.

ancestorLevel
Int32

Pozycja porządkowa żądanego przodka wśród wszystkich przodków danego typu.

Przykłady

Poniższe polecenie zwraca drugi ItemsControl napotkany na ścieżce w górę, zaczynając od elementu docelowego powiązania.

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)

Uwagi

ancestorType i ancestorLevel nie mają znaczenia, jeśli podane jako parametry dla innego mode niż FindAncestor. Nie używaj tego podpisu dla innych RelativeSourceMode wartości.

Dotyczy