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 z trybem początkowym.

RelativeSource(RelativeSourceMode, Type, Int32)

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

RelativeSource()

Inicjuje nowe wystąpienie klasy RelativeSource.

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

Dotyczy

RelativeSource(RelativeSourceMode)

Inicjuje RelativeSource nowe wystąpienie klasy z trybem 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

Jedna z RelativeSourceMode wartości.

Dotyczy

RelativeSource(RelativeSourceMode, Type, Int32)

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

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

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

ancestorType
Type

Type Ancestor, aby szukać.

ancestorLevel
Int32

Położenie porządkowe żądanego przodka wśród wszystkich przodków danego typu.

Przykłady

Poniżej zwraca drugi ItemsControl napotkany na ścieżce w górę rozpoczynającej się 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