ダイアログを表示しようとすると問題が発生します。IUIViusalizerService ShowDialog() メソッドは、次のエラーを生成します。
エラー: 「メソッド 'Show' が 'MyView' に見つかりません
デバッガーは、UIVisualizerService.cs から以下のメソッドまで実行されます (cs ファイルの 380 行目から)。
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. コード ビハインドで「Show()」メソッドを実装する必要がありますか? 2. 使用する必要がある DialogView や DialogViewModel の別の基本クラスはありますか?
Catel 3.6でこの問題が発生し始めました
ありがとうございました