bonjour je travail sur une appliq wpf (c#) et les données sans sur server mysql
1-j'ai crée mon projet wpf
2-j'ai crée mon ado.net "wpf_app1Entities "
3-j'ai crée mon VIEWMODEL :

==> VIEWMODEL

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 class VIEWMODEL : INotifyPropertyChanged
 
    {
        public event PropertyChangedEventHandler PropertyChanged;
 
        protected void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
 
 
 
        private wpf_app1Entities _MON_MODEL;
        public wpf_app1Entities MON_MODEL
        {
            get { return _MON_MODEL; }
            set
            {
                if (value != _MON_MODEL)
                {
                    _MON_MODEL = value;
                    NotifyPropertyChanged("MON_MODEL");
                }
            }
        }
 
 
 
 
 
 
 
 
        private static VIEWMODEL _Instance;
        public static VIEWMODEL Instance
        {
            get
            {
                if (_Instance == null) _Instance = new VIEWMODEL();
                return _Instance;
            }
        }
 
 
        public VIEWMODEL ()
        {
             MON_MODEL = new wpf_app1Entities();
 
                    }
 
 
 
 
    }


4-dans ma fenetre MainPage :


==> MainPage.cs

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
public MainWindow()
        {
            InitializeComponent();
             cc = VIEWMODEL.Instance;
 
            this.DataContext = cc.MON_MODEL;             
        }
==> MainPage.xaml :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<ListBox HorizontalAlignment="Left"  IsSynchronizedWithCurrentItem="True"   ItemTemplate="{StaticResource CustomerListTemplate}"  ItemsSource="{Binding pers }" Margin="7,4,0,131" Name="PerListBox" Width="177"  />
pers = wpf_app1Entities.pers



donc le probleme c quand j'ajoute un per ma listebox ne fais pas le refraiche
par contre dell() et update() c bien
???????????????