RelativeSource Konstruktory

Definice

Inicializuje novou instanci RelativeSource třídy.

Přetížení

Name Description
RelativeSource()

Inicializuje novou instanci RelativeSource třídy.

RelativeSource(RelativeSourceMode)

Inicializuje novou instanci RelativeSource třídy s počátečním režimem.

RelativeSource(RelativeSourceMode, Type, Int32)

Inicializuje novou instanci RelativeSource třídy s počátečním režimem a další kvalifikátory stromové chůze pro vyhledání požadovaného relativního zdroje.

RelativeSource()

Inicializuje novou instanci RelativeSource třídy.

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

Platí pro

RelativeSource(RelativeSourceMode)

Inicializuje novou instanci RelativeSource třídy s počátečním režimem.

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 hodnot.

Platí pro

RelativeSource(RelativeSourceMode, Type, Int32)

Inicializuje novou instanci RelativeSource třídy s počátečním režimem a další kvalifikátory stromové chůze pro vyhledání požadovaného relativního zdroje.

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 hodnot. Aby byl tento podpis relevantní, měl by to být FindAncestor.

ancestorType
Type

Předky Type , které se mají hledat.

ancestorLevel
Int32

Pořadová pozice požadovaného nadřazeného prvku mezi všemi předky daného typu.

Příklady

Následující vrátí sekundu ItemsControl , která byla zjištěna na vzestupné cestě počínaje cílovým prvkem vazby.

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)

Poznámky

ancestorType a ancestorLevel nemají žádnou relevanci, pokud jsou zadány jako parametry jiné než modeFindAncestor. Nepoužívejte tento podpis pro ostatní RelativeSourceMode hodnoty.

Platí pro