The easiest way is to pass MainWindowViewModel's instance to OpenFileViewModel:
public class OpenFileViewModel
{
private MainWindowViewModel _parent;
{
private MainWindowViewModel _parent;
public OpenFileViewModel(MainWindowViewModel parent)
{
_parent = parent;
}
After that you can call/access any public method/property in MainWindowViewModel:
foreach (var item in _parent.myList)
{
...
}
{
...
}
After a bit research I got the Current instance of my Mainviewmodel by the following Code.
MainViewModel mainViewModelInstaince = ServiceLocator.Current.GetInstance<MainViewModel>();
'.NET > MVVM Light' 카테고리의 다른 글
[MVVM-Light]Implementing Progress bar using WPF with MVVM pattern(using BackgroundWorker) (0) | 2013.07.10 |
---|---|
[MVVM-Light] View와 View 사이 통신 (0) | 2013.07.10 |