C#/Prism
[Prism] Navigation view oneTime Instance
딸기우유중독
2023. 2. 1. 17:21
void ExecuteItem1Command(string navigatePath)
{
if (navigatePath != null)
this.regionManager.RequestNavigate("DocumentRegion", navigatePath);
}
RequestNavigate으로 불러와지는 뷰, 뷰모델
위와 같이 IRegionMemberLifetime 상속받고 KeepAlive return false하면 다른뷰로 넘어갈때 인스턴스 해제
RequestNavigate 할때 마다 View instance 생성
- ( 생성된 each View Instance마다 each ViewModel생성 )
위와 같이 INavigationAware상속 후
아래 return false; 추가
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return false;
}
View Navigate할때 기존 View를 타겟으로 할지 말지 정함.
How to create a new view every time navigation occurs in PRISM?
I'm using WPF4 and PRISM4 for my new project. There is a single module with several views in it. The DI is done with unity. When I navigate from ViewA to ViewB for the first time, the ViewB is cr...
stackoverflow.com
728x90