private void RefreshList() { BindingUtility.SyncListToDictionary(inventory.ItemList, viewModelDictionary, pendingList, AddItem, RemoveItem); BindingUtility.SyncListOrder(inventory.ItemList, viewModelList, viewModelDictionary, pendingList); if (selectedItem != null) { // check if selected item is removed if (!viewModelDictionary.ContainsKey(selectedItem)) { SelectItem(null); } } }
void RefreshList() { // sync collection BindingUtility.SyncListToDictionary(inventory.ItemList, controlDictionary, pendingList, AddItemView, RemoveItemView); // update order BindingUtility.SyncViewOrder(inventory.ItemList, controlDictionary, pendingList); // workaround for update grid view LayoutRebuilder.MarkLayoutForRebuild(container); if (selectedItem != null) { // check if selected item is removed if (!controlDictionary.ContainsKey(selectedItem)) { SelectItem(null); } } }