bonjour tout le monde

Je suis débutant en MVVM et WPF et je bloque la dessus

j'ai mon user control :

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
58
59
60
61
<ListView x:Name="ListAps" BorderThickness="0" Grid.Row="2" Margin="0" Height="Auto" Width="auto"  ItemsSource="{Binding Aps}" Background="{x:Null}">
                    <ListView.View>
                        <GridView ColumnHeaderContainerStyle="{StaticResource MasqueHeader}">
 
                            <!--Colonne Nom Appareils Sanitaire-->
                            <GridViewColumn  Width="186">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBox Width="165" HorizontalAlignment="Left" Style="{DynamicResource Nomps}" Text="{Binding Nom}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <!--Colonne Débit Unitaire-->
                            <GridViewColumn Width="70">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                                <TextBox  Width="54"  HorizontalAlignment="Center" Style="{DynamicResource DébitUnitaireps}" Text="{Binding DebitUnitaire}" />
 
 
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <!--Colonne Coefficient individuel-->
                            <GridViewColumn Width="70">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBox  Width="54"  HorizontalAlignment="Center" Style="{DynamicResource CoefpsIsole}" Text="{Binding CoefficientAPSIndividuel}" />
 
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <!--Colonne EF-->
                            <GridViewColumn Width="30">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox HorizontalAlignment="Center" Style="{DynamicResource CroiEF}" IsChecked="{Binding EF}" />
 
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <!--Colonne EC-->
                            <GridViewColumn Width="30">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox HorizontalAlignment="Center" Style="{DynamicResource CroiEC}" IsChecked="{Binding EC}" />
 
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <!--Colonne Quantité-->
                            <GridViewColumn Width="100">
 
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                                <TextBox Text="{Binding Quantite}" Width="84" HorizontalAlignment="Center" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                    </ListView>
mon view model :

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  public class DecompteAppareilsSanitairesViewModel : WorkspaceViewModel, INotifyPropertyChanged
    {
 
        private readonly IDataProvider<APS> ApsProvider;
 
        private int _Quantite;
        public int Quantite
        {
            get
            {
                return _Quantite;
            }
            set
            {
                _Quantite = value;
                OnPropertyChanged("Quantite");
            }
        }
        private ObservableCollection<APS> _Aps;
        public ObservableCollection<APS> Aps
        { get
            {
                return _Aps;
            }
            set
            {
                _Aps = value;
                OnPropertyChanged("Aps");
            }
                }
        public ObservableCollection<string> Listprofil { get; private set; }
        private string _selectedProfil;
        public string SelectedProfil
        {
            get
            {
                return _selectedProfil;
            }
            set
            {
                _selectedProfil = value;
                if (_selectedProfil !=null)
                {
                    var aps = ApsProvider.GetByProfil(_selectedProfil);
                    Aps = new ObservableCollection<APS>(aps);
                }
 
                OnPropertyChanged("SelectedProfil");
            }
        }
 
        public DecompteAppareilsSanitairesViewModel()
        {
            ApsProvider = new ApsDefautXmlProvider("ApsDefaut.xml");
            ReloadProfil();
 
            base.DisplayName = Strings.DecompteAppareilsSanitairesViewModel_DisplayName;
        }
 
        public DecompteAppareilsSanitairesViewModel(IDataProvider<APS> provider)
        {
            ApsProvider = provider;
            ReloadProfil();
                  }
 
        public void ReloadProfil()
        {
            var aps = ApsProvider.GetProfil();
            Listprofil = new ObservableCollection<string>(aps);
 
        }
J'aurais voulu récupérer les valeurs des textbox "Quantités" (rentrer en manuel) dans la listview à transformer en int et les sommer en fonction que CroixEF soit checked et rebalancer la somme des quantités dans une textbox ne faisant pas partie de la listview.
Je ne sais pas si je suis hyper clair sur ma demande.
N'hésiter pas à me demander plus de détail si vous voulez bien m'aider.

en gros :

Quantité1 = 2 CroixEF=True
Quantité2 = 5 CroixEF=False
Quantité3 = 7 CroixEF =True

Total = 8

Sans que le nombre de textbox quantité soit défini, vu que une combobox me met à jour ma listview suivant le profil utilisé, (nombre de textbox "Quantité" variable)

Je ne sais pas si je suis hyper clair sur ma demande.
N'hésiter pas à me demander plus de détail si vous voulez bien m'aider.

Merci d'avance
Cordialement tlm