Search code examples
listviewxamarinbindingcustom-cell

Xamarin How to create customCell with custom data


As i'm understood,we use the method "SetBinding" for to obtain data But if i'm use a custom class for data, i havn't that method. How i can extend the my class for that?

var image = new Image();
var nameLabel = new Label();
var typeLabel = new Label();

//set bindings
nameLabel.SetBinding(Label.TextProperty, new Binding("Name"));
typeLabel.SetBinding(Label.TextProperty, new Binding("Type"));
image.SetBinding(Image.SourceProperty, new Binding("Image"));

my class:

public class TextTable
    {
        public string Name { get; set; }
        public string[] Column { get; set; }
        public DataFormat[] Data { get; set; }
     }

Solution

  • SetBinding is a UI object's method