This is design xaml: it include a listview display list image, title, subtilte.
<ListView x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout BackgroundColor="#eee"
Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Image Source="{Binding image}" />
<Label Text="{Binding title}"
TextColor="#f35e20" />
<Label Text="{Binding subtitle}"
HorizontalOptions="EndAndExpand"
TextColor="#503026" />
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I add process load data to listview:
public ListAccount ()
{
InitializeComponent ();
var dt = new System.Data.DataTable();
dt.Columns.Add("image");
dt.Columns.Add("title");
dt.Columns.Add("subtitle");
var dr = dt.NewRow();
dr["image"] = "a.jpg";
dr["title"] = "title";
dr["subtitle"] = "subtitle1";
dt.Rows.Add(dr);
listView.ItemsSource = dt.DefaultView ;
}
Result:
Why row not display?
How can display listview from a datatable?
