private void Execute(object parameter) { int index = Mechanisms.IndexOf(parameter as Mechanism); if (index > -1 && index < Mechanisms.Count) { DbMechanism au = new DbMechanism(); } }
public MechanismViewModel() { Mechanism = new Mechanism(); DbMechanism me = new DbMechanism(); List <Mechanism> mechanismLst = me.FindAllMechanismBySectionAndEvent(); Mechanisms = new ObservableCollection <Mechanism>(); foreach (var item in mechanismLst) { Mechanisms.Add(item); } Mechanisms.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Mechanisms_CollectionChanged); }