Nyelv

RelativeSource Konstruktorok

Definíció

Inicializálja a RelativeSource osztály új példányát.

Túlterhelések

Name Description
RelativeSource()

Inicializálja a RelativeSource osztály új példányát.

RelativeSource(RelativeSourceMode)

Inicializálja az RelativeSource osztály új példányát kezdeti móddal.

RelativeSource(RelativeSourceMode, Type, Int32)

Inicializálja az RelativeSource osztály új példányát egy kezdeti móddal és további fajárási minősítőkkel a kívánt relatív forrás megtalálásához.

RelativeSource()

Inicializálja a RelativeSource osztály új példányát.

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

A következőre érvényes:

RelativeSource(RelativeSourceMode)

Inicializálja az RelativeSource osztály új példányát kezdeti móddal.

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)

Paraméterek

mode
RelativeSourceMode

Az egyik RelativeSourceMode érték.

A következőre érvényes:

RelativeSource(RelativeSourceMode, Type, Int32)

Inicializálja az RelativeSource osztály új példányát egy kezdeti móddal és további fajárási minősítőkkel a kívánt relatív forrás megtalálásához.

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)

Paraméterek

mode
RelativeSourceMode

Az egyik RelativeSourceMode érték. Ahhoz, hogy ez az aláírás releváns legyen, ennek kell lennie FindAncestor.

ancestorType
Type

A Type keresendő ős.

ancestorLevel
Int32

A kívánt ős sorrendi pozíciója az adott típus összes elődje között.

Példák

Az alábbiak a kötés célelemétől kezdődően a felfelé irányuló útvonalon észlelt második ItemsControl értéket adja vissza.

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)

Megjegyzések

ancestorType és ancestorLevel nincs jelentősége, ha más paraméterként mode van megadva, mint FindAncestora . Ne használja ezt az aláírást a többi RelativeSourceMode értékhez.

A következőre érvényes: