代码如下 | 复制代码 |
|
代码如下 | 复制代码 |
代码如下 | 复制代码 |
public partial class MainWindow : Window
{ public MainWindow() { InitializeComponent(); var Persons = new List
for (int i = 0; i < 10; i++) { Persons.Add(new person {Image="/Image/user00"+i+".png", Title = "关注的人最新更新:" + i.ToString(), Time = "创建时间:" + DateTime.Now.ToShortDateString().ToString() ,Author="作者:"+i.ToString()}); } listBox1.ItemsSource = Persons; }
public class person { private string image; public string Image
{ get { return image; } set { image = value; } } private string title; public string Title
{ get { return title; } set { title = value; } } private string time; public string Time
{ get { return time; } set { time = value; } } private string author; public string Author
{ get { return author; } set { author = value; } } } } |