BindableObject.SetBinding(BindableProperty, BindingBase) Méthode
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.
Affecte une liaison à une propriété pouvant être liée.
public:
void SetBinding(Microsoft::Maui::Controls::BindableProperty ^ targetProperty, Microsoft::Maui::Controls::BindingBase ^ binding);
public void SetBinding (Microsoft.Maui.Controls.BindableProperty targetProperty, Microsoft.Maui.Controls.BindingBase binding);
member this.SetBinding : Microsoft.Maui.Controls.BindableProperty * Microsoft.Maui.Controls.BindingBase -> unit
Public Sub SetBinding (targetProperty As BindableProperty, binding As BindingBase)
Paramètres
- targetProperty
- BindableProperty
Propriété pouvant être liée sur laquelle appliquer binding
.
- binding
- BindingBase
Liaison à définir pour targetProperty
.
Remarques
L’exemple suivant montre comment définir une liaison à une propriété :
var label = new Label ();
label.SetBinding (Label.TextProperty, new Binding ("Name"));
label.BindingContext = new {
Name = "John Doe",
Company = "Xamarin"
};
Debug.WriteLine (label.Text); // prints "John Doe"
S’applique à
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.
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