次のレイアウト ViewModels --DialogViewModel --GraphViewModel Views --DialogView --GraphView を持つ非常に単純な WPF テスト アプリケーションがあります。
DialogViewModel には次のコードがあります。
public class DialogViewModel : Screen {
#region Graph
private GraphViewModel m_gvmGraph;
public GraphViewModel Graph {
get {
if(m_gvmGraph == null) {
m_gvmGraph = new GraphViewModel();
}
return m_gvmGraph;
}
set {
if(m_gvmGraph != value) {
m_gvmGraph = value;
NotifyOfPropertyChange("Graph");
}
}
}
#endregion
public DialogViewModel() {
DisplayName = "Graph Dialog";
}
GraphViewModel にはコードがありません。
DialogView (UserControl) は次のようになります。
d:DataContext="{d:DesignInstance Type=VMs:DialogViewModel, IsDesignTimeCreatable=True}"
Cal:Bind.AtDesignTime="True"
Width="1000" Height="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<ContentControl x:Name="Graph" />
</Grid>
GraphView (UserControl) は次のようになります。
d:DataContext="{d:DesignInstance Type=VMs:GraphViewModel, IsDesignTimeCreatable=True}"
Cal:Bind.AtDesignTime="True"
d:DesignHeight="600" d:DesignWidth="800">
<Grid>
<Grid>
<Grid>
<TextBlock Text="Test" />
</Grid>
</Grid>
</Grid>
(後でネストされたグリッドが必要になります。ここでは問題ありません)。
これは、実行時に期待どおりに機能します (ビューの読み込みなど)。だから私は(ほとんど)正しく行われていると思います。
しかし、設計時に (GraphView.xaml を開くと、「XXXX.ViewModels.GraphViewModel のビューが見つかりません。」
私は何が欠けていますか?