using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;
namespace WpfApplication2
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
//listBox1.SelectedValue 是一个Person类型
button1.Content = (listBox1.SelectedValue as Person).name;
}
}
public class photo : List<Person>
{
public photo()
{
Add(new Person("张三", @"d:\temp\1.png"));
Add(new Person("李四", @"d:\temp\j.png"));
Add(new Person("王五", @"d:\temp\person.png"));
Add(new Person("赵六", @"d:\temp\s.png"));
}
}
public class Person
{
public string name;
public string imgurl;
public Person()
{ }
public Person(string value1, string value2)
{
this.name = value1;
this.imgurl = value2;
}
public string PersonName
{
get { return name; }
set { name = value; }
}
public string ImgUrl
{
get { return imgurl; }
set { imgurl = value; }
}
}
}