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 55 56 57 58 59 60 61 62 63 64 65 66
| namespace WpfGrid
{
public class Item:INotifyPropertyChanged
{
private string nom;
public string Nom
{
get { return nom; }
set
{
nom = value; Raise("Nom");
}
}
private int col;
public int Col
{
get { return col; }
set
{
col = value; Raise("Col");
}
}
private int row;
public int Row
{
get { return row; }
set
{
row = value; Raise("Row");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void Raise(string nomProp)
{
PropertyChangedEventHandler h = PropertyChanged;
if (h != null)
h(this, new PropertyChangedEventArgs(nomProp));
}
}
public class Items: List<Item>
{
private Item it;
public Items()
{
it = new Item() { Nom = "item00", Row=0,Col= 0 };
this.Add(it);
it = new Item() { Nom = "item21" ,Row= 2, Col = 1 };
this.Add(it);
it = new Item() { Nom = "item33" ,Row= 3, Col = 3 };
this.Add(it);
it = new Item() { Nom = "item42" ,Row= 4,Col = 2 };
this.Add(it);
it = new Item() { Nom = "item52" ,Row= 5 ,Col = 2 };
this.Add(it);
it = new Item() { Nom = "item53" ,Row= 5, Col = 3 };
this.Add(it);
}
} |
Partager