如何從列表中選擇特定的類項目?我只想綁定標籤中的名稱。如何從列表中選擇特定的課程項目?
mycountry.cs
public class mycountry{
private string Id;
private string name;
private string capital;
private string majorcity;
public string ID { get{return Id;} set{Id = value;}}
public string Name { get{return name;} set{name = value;}}
public string Capital { get{return capital;} set{capital = value;}}
public string Majorcity { get{return majorcity;} set{majorcity = value;}}
}
mycountrypage.xaml.cs
List<mycountry> c;
c = DB.GetCountry();
ListView list = new ListView{
ItemsSource = c,
ItemTemplate = new DataTemplate(() =>{
Label name = new Label(); name.SetBinding(Label.TextProperty, c.?)}
}
@mybirthname謝謝。現在我可以選擇名稱。 – batman