var nameEntry = new Entry(); nameEntry.SetBinding(Entry.TextProperty, "Name"); // Binds the Text property of the Entry to the Name property in the model
In this example, a horizontal StackLayout is used to organize two sets of Label and Entry controls. SetBinding is used to bind the Text property of each Entry control to the corresponding property in the model. This means that any changes made to the Entry controls will be reflected in the corresponding properties of the model. Package library: Xamarin.Forms.var firstNameEntry = new Entry(); firstNameEntry.SetBinding(Entry.TextProperty, "FirstName"); var lastNameEntry = new Entry(); lastNameEntry.SetBinding(Entry.TextProperty, "LastName");