에 나는 메뉴 MainWindow를 같은 Catel.Window을 가지고 있고, 주요 내용은 다음과 같습니다분리 MVVM보기 Catel
public ViewModelBase ActualVM { get; set; }
가 MainWindowViewModel가에 ActualVM을 설정하십시오 MainWindowViewModel에서
<ContentControl Content="{Binding ActualVM, Converter={catel:ViewModelToViewConverter}}" />
메뉴 명령의 OnExecute 메서드 그것은 잘 작동합니다. 실제보기를 새 창으로 분리 할 수 있어야합니다. 하나의 뷰의 코드에서 나는 버튼의 클릭에 대해 다음 넣어 뒤에 :
protected void DetachClick(object obj, RoutedEventArgs e)
{
ContentPresenter vp = this.GetVisualParent() as ContentPresenter;
if (vp != null)
{
vp.Content = null;
var dw = new DetachWindow();
dw.Content = this;
dw.Show();
}
}
DetachWindow는 "빈"뷰 모델과 "빈"Catel.Window입니다. 또한 잘 작동,보기 및 viewmodell 분리 된 창에서 작동하지만 MainWindows의 menuitems 중 하나를 클릭하면 MainWindowViewModel ActualVM 설정하지만 MainWindows보기 전에 detach 전에 않았다 보여줍니다. 업데이트됩니다 바인딩 제대로 대신 교체는 A 바인딩 때문에 null로 당신은 VM에 값을 설정해야합니다
vp.Content = null;
:
고마워요! –