Exemplo n.º 1
0
        private void GetData(CategoryModel category)
        {
            int index = -1;

            if (SelectedData != null)
            {
                index = DataList.IndexOf(SelectedData);
            }

            DataList.Clear();
            if (category != null)
            {
                foreach (var data in storageHandler.GetData(category))
                {
                    DataList.Add(data);
                }
            }
            OnPropertyChanged(nameof(DataList));

            if (index > -1 && index < DataList.Count)
            {
                SelectedData = DataList[index];
            }
            else
            {
                SelectedData = null;
            }
            OnPropertyChanged(nameof(SelectedData));
        }