0
我在嘗試顯示對話框時遇到了麻煩。所述IUIViusalizerService的ShowDialog()方法產生以下錯誤:Catel IUIViusalizerService ShowDialog()錯誤
錯誤:「方法‘顯示’上‘MyView的’未找到
調試器運行到UIVisualizerService.cs下面的方法(上線380在開始CS文件):
protected virtual bool? ShowWindow(FrameworkElement window, bool showModal)
{
if (showModal)
{
var showDialogMethodInfo = window.GetType().GetMethodEx("ShowDialog");
if (showDialogMethodInfo != null)
{
// Child window does not have a ShowDialog, so not null is allowed
return showDialogMethodInfo.Invoke(window, null) as bool?;
}
Log.Warning("Method 'ShowDialog' not found on '{0}', falling back to 'Show'", window.GetType().Name);
}
var showMethodInfo = window.GetType().GetMethodEx("Show");
if (showMethodInfo == null)
{
string error = string.Format("Method 'Show' not found on '{0}', cannot show the window", window.GetType().Name);
Log.Error(error);
throw new NotSupportedException(error);
}
showMethodInfo.Invoke(window, null);
return null;
}
我的調用代碼:
public MainWindowViewModel()
{
ViewModels.MyViewModel mv = new MyViewModel();
var ui = GetService<IUIVisualizerService>();
ui.ShowDialog(mv)
}
問題: 1.我應該impliment一個 「Show()」 甲基od在代碼後面? 2.是否有必須使用DialogView和/或DialogViewModel的不同基類?
我開始與Catel這個問題3.6
謝謝
1.不可以。2.對話視圖/ viewmodels應該從Catel.Windows.DataWindow繼承。 –