public void btnSubmitClick(object sender, EventArgs e) { var bindingContext = BindingContext as NewContactViewModel; string newContactName = entryNewName.Text; if (!String.IsNullOrEmpty(newContactName)) { var contactsList = bindingContext.ContactsList; contactsList.Add(ContactsLocalRepository.AddNewContact(newContactName)); bindingContext.ContactsList = new ObservableCollection <Contact>(contactsList.OrderByDescending <Contact, string>(x => x.DisplayName)); //TODO: il nuovo item viene aggiunto in coda alla lista e neanche OrderBy ha effetto } Navigation.PopAsync(); }
public ContactsViewModel() { _contactsList = new ObservableCollection <Contact>(); _searchText = ""; ContactsList = ContactsLocalRepository.ReadAll(); }