RelativeSource.AncestorType Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállítja a keresendő előd típusát.
public:
property Type ^ AncestorType { Type ^ get(); void set(Type ^ value); };
public Type AncestorType { get; set; }
member this.AncestorType : Type with get, set
Public Property AncestorType As Type
Tulajdonság értéke
Az előd típusa. Az alapértelmezett érték a null.
Kivételek
Ez RelativeSource nincs FindAncestor módban.
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
Ha a Mode tulajdonság nincs explicit módon beállítva, a AncestorType beállítás vagy a AncestorLevel tulajdonság implicit módon zárolja a Mode tulajdonság értékét FindAncestor.
XAML-szöveghasználat
Az XAML-információkért lásd: RelativeSource MarkupExtension.