Hi ,
I have ViewModel class object , which nested type from lot of other models class.
when i am binding View object to property grid data context .
everythings work okay , but when i add collection inside collection , its showing problem.
Below is my simple code.:
Model class 1: CEnumVal.cs
Model Class 2 : CEnumType.cs
Model Class 3 : CConfiguration.cs
View Model class :
CConfigurationViewModel.cs
View class
CConfigurationView.Xaml
I have ViewModel class object , which nested type from lot of other models class.
when i am binding View object to property grid data context .
everythings work okay , but when i add collection inside collection , its showing problem.
Below is my simple code.:
Model class 1: CEnumVal.cs
public class CEnumVal
{
private string _ord;
public string Ord
{
get { return _ord; }
set { _ord = value; }
}
public CEnumVal() //ctor
{}
}Model Class 2 : CEnumType.cs
public class CEnumType
{
private string _id;
private ObservableCollection<CEnumVal> _enumValList;
[ExpandableObject]
public ObservableCollection<CEnumVal> EnumValList
{
get { return _enumValList; }
set
{
_enumValList = value;
}
}
public CEnumType() //ctor
{
EnumValList = new ObservableCollection<CEnumVal>();
}Model Class 3 : CConfiguration.cs
public class CConfiguration
{
private ObservableCollection<CEnumType> _dataTypeTemplates;
[ExpandableObject]
public ObservableCollection<CEnumType> DataTypeTemplates
{
get { return _dataTypeTemplates; }
set
{
_dataTypeTemplates = value;
}
}
public CConfiguration() // ctor
{
DataTypeTemplates = new ObservableCollection<CEnumType>();
}
View Model class :
CConfigurationViewModel.cs
public class CConfigurationViewModel
{
private CConfiguration _ConfigrObj;
[ExpandableObject]
public CConfiguration ConfigrObj
{
get { return _ConfigrObj; }
set
{
_ConfigrObj = value;
}
}
public CConfigurationViewModel() //ctor
{
ConfigrObj = new CConfiguration();
}
View class
public CConfigurationView()
{
InitializeComponent();
CConfigurationViewModel _vmConfiguration = new CConfigurationViewModel();
this.DataContext = _vmConfiguration;
}
CConfigurationView.Xaml
<xctk:PropertyGrid x:Name="_propertyGrid" Width="Auto" Height="Auto" Margin="10"
SelectedObject="{Binding}" />
please tell me if more info is required. its the main problem of ObservableCollection inside ObservableCollection .