public void AddItems()
 {
     LesElementsAAfficher.Clear();
     AjusterLesElements();
     if (TbRech.Text == "")
     {
         LesElementsAAfficher = LesElementsAAfficherB;
     }
     else
     {
         foreach (AffichableEnListeBox alb in LesElementsAAfficherB)
         {
             if (alb is ExceptionUVM)
             {
                 if (((ExceptionUVM)alb).NoMachine.ToString().ToUpper().StartsWith(TbRech.Text.ToUpper()))
                 {
                     LesElementsAAfficher.Add(alb);
                 }
             }
             if (alb is IndisponibilitéVM)
             {
                 if (((IndisponibilitéVM)alb).NoMachineIndispo.ToString().ToUpper().StartsWith(TbRech.Text.ToUpper()))
                 {
                     LesElementsAAfficher.Add(alb);
                 }
             }
         }
     }
 }
        private void MenuSupprExcepts_OnClick(object sender, RoutedEventArgs e)
        {
            MenuItem    mi = sender as MenuItem;
            ContextMenu cm = mi.Parent as ContextMenu;
            Popup       p  = cm.Parent as Popup;
            Grid        g  = p.PlacementTarget as Grid;

            if (g.Name == "MyGrid")
            {
                DataBase.DeleteElementAAfficher(g.DataContext as ExceptionUVM);
                int res = LesElementsAAfficher.IndexOf(g.DataContext as ExceptionUVM);
                LesElementsAAfficher.RemoveAt(res);
            }
        }