RelativeSource Konstruktory
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Inicjuje nowe wystąpienie klasy RelativeSource.
Przeciążenia
| Nazwa | Opis |
|---|---|
| RelativeSource() |
Inicjuje nowe wystąpienie klasy RelativeSource. |
| RelativeSource(RelativeSourceMode) |
Inicjuje nowe wystąpienie RelativeSource klasy z trybem 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 nowe wystąpienie RelativeSource 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
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.
- ancestorLevel
- Int32
Położenie porządkowe żądanego przodka wśród wszystkich przodków danego typu.
Przykłady
Poniżej zostanie zwrócony 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ą istotności, jeśli podano jako parametry dla innej mode niż FindAncestor. Nie używaj tego podpisu dla innych RelativeSourceMode wartości.