BindableObject.BindingContextProperty Champ
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Propriété pouvant être liée pour BindingContext.
public: static initonly Microsoft::Maui::Controls::BindableProperty ^ BindingContextProperty;
public static readonly Microsoft.Maui.Controls.BindableProperty BindingContextProperty;
staticval mutable BindingContextProperty : Microsoft.Maui.Controls.BindableProperty
Public Shared ReadOnly BindingContextProperty As BindableProperty
Valeur de champ
Remarques
En règle générale, les performances d’exécution sont meilleures si BindingContext est défini après tous les appels à SetBinding(BindableProperty, BindingBase) avoir été effectués.
L’exemple suivant montre comment définir une liaison à BindingContext :
class PersonView : ContentView
{
public PersonView ()
{
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
Content = label;
}
}
var stack = new StackLayout {
Orientation = StackOrientation.Vertical,
};
var jane = new PersonView ();
jane.SetBinding (BindableObject.BindingContext, "Jane");
stack.Children.Add (jane);
var john = new PersonView ();
john.SetBinding (BindableObject.BindingContext, "John");
stack.Children.Add (john);
stack.BindingContext = new {Jane = new {Name = "Jane Doe"}, John = new {Name = "John Doe"}};
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour