private void DeleteDeviceExecute(object obj) { int index = DeviceList.IndexOf(selectValue); _model.Delete(selectValue); if (index > 0) { SelectValue = DeviceList.ElementAt(--index); } else { SelectValue = DeviceList.ElementAt(0); } _document.IsDirty = true; }