MainWindow.xamlに次のComboBoxがあります。
<ComboBox ItemsSource="{Binding ComboItemsProperty}" />
MainWindow.xaml.csの場合:
ObservableCollection<string> ComboItemsField =
new ObservableCollection<string>();
public ObservableCollection<string> ComboItemsProperty
{
get { return ComboItemsField; }
set { ComboItemsField = value; }
}
これは完璧に機能します!プロパティにアイテムを追加して、ComboBox要素を正常にシリアル化できます。
私の質問は、UserControl.xamlとUserControl.xaml.csにこの正確なコードがあるのに、コントロールをシリアル化しようとすると次のエラーが発生するのはなぜですか。
ジェネリック型'System.Collections.ObjectModel.ObservaleCollection'1[System.String]'をシリアル化できません
何かご意見は?