1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
namespace WpfSimpleListBoxDrag
{
public class Person
{
public Person()
{}
public Person( string fn,int n,string u)
{
this.FirstName=fn;
this.ID = n;
this.UriImage = u;
}
public string FirstName { get; set; }
public int ID { get; set; }
public string UriImage { get; set; }
}
public class Persons:ObservableCollection<Person>
{
Person p;
Random rnd = new Random();
string urImg ;
public Persons()
{
for (int i = 0; i < 9; i++)
{
urImg ="MesImages/giraffe.jpg";
p = new Person("MyItem"+(i+1),rnd.Next(50,100),urImg);
this.Add(p);
urImg ="MesImages/mouse.jpg";
p = new Person("MyItem"+(i+1),rnd.Next(50,100),urImg);
this.Add(p);
urImg ="MesImages/ZebrasThree.jpg";
p = new Person("MyItem"+(i+1),rnd.Next(50,100),urImg);
this.Add(p);
urImg ="MesImages/zebra.jpg";
p = new Person("MyItem"+(i+1),rnd.Next(50,100),urImg);
this.Add(p);
}
}
}
} |
Partager