Как я могу вывести данные из List<> в xaml файле?
public class Fruit
{
public string Name{ get; set; }
public ImageSource Image { get; set; }
public string Price{ get; set; }
}
public MainPage()
{
InitializeComponent();
List<Fruit> fruits= new List<Fruit>()
{
new Fruit(){Name= "Apple" , Image = ImageSource.FromFile("apple.png")},
new Fruit(){Name= "Orange" , Image = ImageSource.FromFile("orange.png")},
new Fruit(){Name= "Pear" , Image = ImageSource.FromFile("pear.png")},
new Fruit(){Name= "Mandarin" , Image = ImageSource.FromFile("mandarine.png")}
};
<ScrollView x:Name="scrollview" Orientation="Vertical">
<StackLayout x:Name="stacklayoutscrollview">
??????
</StackLayout>
</ScrollView>
ItemsControl
(ListBox
,ListView
. самItemsControl
) берите и привязывайте его.