Exemplo n.º 1
0
 private void SetCheckedStatus()
 {
     if (SelectedStockSysNo != null)
     {
         List <StockVM> result = cmbStockList.ItemsSource as List <StockVM>;
         if (result != null)
         {
             var clone = SelectedStockSysNo.DeepCopy();
             result.ForEach(f => f.IsChecked = false);
             foreach (var itemValue in clone)
             {
                 result.Where(w => w.SysNo == itemValue).ForEach(x => x.IsChecked = true);
             }
         }
     }
 }
Exemplo n.º 2
0
        void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            cmbStockList.SelectedItem = null;
            StockVM itemVM = (StockVM)sender;

            if (itemVM.SysNo.HasValue)
            {
                if (itemVM.IsChecked && !SelectedStockSysNo.Any(f => f == itemVM.SysNo))
                {
                    SelectedStockSysNo.Add(itemVM.SysNo.Value);
                }
                else if (!itemVM.IsChecked && SelectedStockSysNo.Any(f => f == itemVM.SysNo))
                {
                    SelectedStockSysNo.Remove(itemVM.SysNo.Value);
                }
            }
            SetString();
        }