class?Student
{
public?int?Id?{?get;?set;?}
public?string?Name?{?get;?set;?}
public?DateTime?Birth?{?get;?set;?}
}//定義ListView?視圖結構
<ListView?x:Name="livStudent">
<ListView.View>
<GridView>
<GridViewColumn?Header="Id"?DisplayMemberBinding="{Binding?Path=Id}"?/>
<GridViewColumn?Header="Name"?DisplayMemberBinding="{Binding?Path=Name}"?/>
<GridViewColumn?Header="Birth"?DisplayMemberBinding="{Binding?Path=Birth}"?/>
</GridView>
</ListView.View>
</ListView>//構造數據源
var?students?=?new?Student[2];
students[0]?=?new?Student()?{?Id?=?1,?Name?=?"a",?Birth?=?new?DateTime(2015,?1,?1)?};
students[1]?=?new?Student()?{?Id?=?2,?Name?=?"b",?Birth?=?new?DateTime(2015,?2,?1)};
//綁定數據
livStudent.ItemsSource?=?students;
DisplayMemberBinding="{Binding Path=Id}"
設置綁定的屬性名稱, 註意:是屬性。