WPF Prism deactivate ?

Posted by 2Fast4YouBR on Stack Overflow See other posts from Stack Overflow or by 2Fast4YouBR
Published on 2010-05-14T19:15:01Z Indexed on 2010/05/27 7:51 UTC
Read the original article Hit count: 154

Filed under:
|
|
|
|

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));
}

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm