Hello,
i used RadGridView to show some items. I have defined some columns of RadGridView and bind ItemsSource with list of ViewModelABC, which is a type of IViewModel.
public
interface
IViewModel
{
}
public
Class ViewModelABC : IViewModel
{
public
string
PropertyA {
get
;
set
; }
public
string
PropertyB {
get
;
set
; }
public
string
PropertyC {
get
;
set
; }
}
public
Class MyData
{
public
MyData()
{
MyItems =
new
List<IViewModel>();
// MyItems could be filled with ViewModelABC
//MyItems.Add(new ViewModelABC());
}
public
IList<IViewModel> MyItems {
get
;
set
;}
}
ViewModelABC has implemented the interface IViewModel and some properties.
When i start the application without Items, that meas, my MyData as DataContext is initialized, but it has no entry for ItemsSource in MyItems. Then i get ArgumentException from each column. "Property with name 'PropertyA' cannot be found on type 'IViewModel'.
I don't want to defined the list with type ViewModelABC. Is there another way to avoid the ArgumentException?
Thanks a lot.
Regards,
Ivan