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 67 68 69 70 71 72 73
|
public class ProduitViewModel : ViewModel
{
private CollectionViewSource cvsprod;
private CollectionViewSource cvsgest;
private DomainService1 s;
public ProduitViewModel()
{
cvsprod = new CollectionViewSource();
cvsgest = new CollectionViewSource();
ocproduit = new ObservableCollection<produit>();
s = new DomainService1();
}
public void Binds()
{
Binding b = new Binding();
b.Source = cvsprod.View;
b.Path = new PropertyPath("gestion");
b.Mode = BindingMode.TwoWay;
BindingOperations.SetBinding(cvsgest, CollectionViewSource.SourceProperty, b);
}
public void Loadproduit()
{
cvsprod.Source = s.produits;
s.Load<produit>(s.GetProduitQuery());
Binds();
}
public CollectionViewSource Cvsprod
{
get {
return cvsprod; }
set { cvsprod = value;
OnPropertyChanged("Cvsprod");
}
}
public CollectionViewSource Cvsgest
{
get
{
return cvsgest;
}
set { cvsgest = value;
OnPropertyChanged("Cvsgest");
}
}
public IEnumerable<produit> Results
{
get {
return s.produits; }
}
}
} |
Partager