views:

38

answers:

0

Hi all,

I have an problem and would like to know if it is common problem or jsut with me. I am using Wpf with Prism and Unity, all with the pattern MvvM.

I am loading a viewModel that has a reference to a dropdown with few items, my idea is that each time that the user click in some place to open the view that has this dropdown is that the dropdown will be shown with diferent values.

The problem is that I see is that after I show the view for the first time and after the first DEACTIVATE, when I try to load it again looks like it is already in the memory (was not deactivated/disposed), so as is already in memory, it not call the constructor again of the modelView and the dropdown is shown with tha same old values.

public BranchSelectionViewModel(IUnityContainer unityContainer)
{
     this.unityContainer = unityContainer;

     User user = this.unityContainer.Resolve<User>();
     this.branches = new ObservableCollection<Department>(user.Departments
                     .Where(department => department.DepartmentId != user.SelectedDepartment.DepartmentId));
}