どんな時に困るのか
Xamlを記述している時に、データが無いと困ることが、良くあります。
そんな時は、下記のように、d:DesignProperties.DataContextタグを使用します。
Test.xaml
<d:DesignProperties.DataContext>
<x:Array Type="{x:Type entity:SampleInfomation}">
</entity:SampleInfomation>
</entity:SampleInfomation>
</entity:SampleInfomation>
</x:Array>
</d:DesignProperties.DataContext>
ところが、クラス内で、ObservableCollectionを利用しているとXamlに記述することができません。
ObservableCollectionというジェネリクスな型指定がだめなようです。
解決策
下記のようなクラスを用意します。
entityクラスのcsファイル内に、併記しておくと良いかも知れません。
ObservableCollection_SubItem.cs
public class ObservableCollection_SubItem : ObservableCollection<SubItem> {}
Test.xaml
<d:DesignProperties.DataContext>
<x:Array Type="{x:Type entity:SampleInfomation}">
</entity:SampleInfomation>
<!-- ObservableCollectio<SubItem> Items へデータを追加 -->
<entity:SampleInfomation.Items>
<entity:ObservableCollection_SubItem>
<entity:SubItem/>
<entity:SubItem/>
<entity:SubItem/>
</entity:ObservableCollection_SubItem>
</entity:SampleInfomation.Items>
</entity:SampleInfomation>
</entity:SampleInfomation>
</x:Array>
</d:DesignProperties.DataContext>
Xamlだけでは、解決できませんがダミーデータを用意するときに覚えておくと便利です。