private void NotifyStatutToMngr(PosteChargeVM pcvm, ThreeStateToggleButton.Statut state)
        {
            int indexOfGroupeVm = Mngr.LesGroupeVMs.IndexOf(FindGroupeVmFromPdcVm(pcvm));
            int indexOfPdcVm    = Mngr.LesGroupeVMs[indexOfGroupeVm].LesPosteChargeVMs.IndexOf(pcvm);

            Mngr.LesGroupeVMs[indexOfGroupeVm].LesPosteChargeVMs[indexOfPdcVm].Statut = state;
        }
 private GroupeVM FindGroupeVmFromPdcVm(PosteChargeVM pcvm)
 {
     foreach (GroupeVM groupeVm in Mngr.SelectedGroupes)
     {
         if (groupeVm.LesPosteChargeVMs.Contains(pcvm))
         {
             return(groupeVm);
         }
     }
     return(null);
 }
        private void LvPdcs_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                //------------
                PosteChargeVM          grp   = (PosteChargeVM)e.AddedItems[0];
                ListViewItem           lvi   = (ListViewItem)lvPdcs.ItemContainerGenerator.ContainerFromItem(grp);
                ThreeStateToggleButton chkBx = FindVisualChild <ThreeStateToggleButton>(lvi);
                if (chkBx != null)
                {
                    chkBx.Dot_MouseLeftButtonDown(sender, null);
                    ListBoxItem item = ItemsControl.ContainerFromElement(lvPdcs, chkBx as DependencyObject) as ListBoxItem;

                    NotifyStatutToMngr(grp, chkBx.Toggled1);
                }
            }
            else // Remove Select All chkBox
            {
                PosteChargeVM          grp   = (PosteChargeVM)e.RemovedItems[0];
                ListViewItem           lvi   = (ListViewItem)lvPdcs.ItemContainerGenerator.ContainerFromItem(grp);
                ThreeStateToggleButton chkBx = FindVisualChild <ThreeStateToggleButton>(lvi);
                if (chkBx != null)
                {
                    chkBx.Dot_MouseLeftButtonDown(sender, null);
                    NotifyStatutToMngr(grp, chkBx.Toggled1);

                    /*chkBx.Toggled1 = false;
                     * chkBx.Back.Fill = chkBx.Off;
                     * chkBx.Dot.Margin = chkBx.LeftSide;
                     * chkBx.Dot.Fill = new SolidColorBrush(Color.FromRgb(255, 255, 255));*/
                    ListBoxItem item = ItemsControl.ContainerFromElement(lvPdcs, chkBx as DependencyObject) as ListBoxItem;

                    /*if (item != null)
                     * {
                     *  item.IsSelected = false;
                     * }*/
                }
            }
        }