Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Currently im having troubles in keeping the collections in the list in the mvvm, every time that i navigate away and return to a page, the list keeps getting empty. how am i going to deal with this? can someone help me with this?


C#
class CartingDataSource : BindableBase
    {
public ObservableCollection<CartData> _cartData;

public ObservableCollection<CartData> CartData
        {

         get {
             return _cartData;
             }
        set {

                SetProperty(ref _cartData, value);
           }
        }
 private DelegateCommand _addItemCommand;
        public ICommand AddItemCommand
        {
            get
            {
                if (_addItemCommand == null)
                {
                    _addItemCommand = new DelegateCommand(AddToCart);
                }
                return _addItemCommand;
            }
        }
Posted
Comments
Tomas Takac 6-Mar-14 15:48pm    
Do you think that posting exactly the same question over and over again will help you? I already told you where to look. You don't show any sign of progress. It seems to me you are not actively looking for a solution yourself.
hack.luminence 6-Mar-14 15:53pm    
i have tried many solutions but none of them works, i dont intantiate the list. sorry for repost

1 solution

It seems your View object is loading every time. Please load the view object at first time and store it into RegionManager. Then check if region manager has view, you can get View object from region manager. PRISM allows to get already available view from region manager.

Artha
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900