Hello
I have the setup as described below. I use the trial version binaries 2009.3.1314.35.
If you run this example and try to insert a new row by pressing the 'insert'-Key, then you result in an ArgumentException:
{"Property with specified name: cannot be found on type: WpfApplication1.SimpleObject\r\nParameter name: propertyName"}.
The problem seems to be the 'SimpleObject'-Class. If you remove, or comment out, the ICustomTypeDescriptor interface from the class declaration then everything works ok.
Do you know this problem? Is there a solution or a work around?
Best regards,
Franziska
xaml:
Code behind:
DataContext:
PMod:
Simple Object:
I have the setup as described below. I use the trial version binaries 2009.3.1314.35.
If you run this example and try to insert a new row by pressing the 'insert'-Key, then you result in an ArgumentException:
{"Property with specified name: cannot be found on type: WpfApplication1.SimpleObject\r\nParameter name: propertyName"}.
The problem seems to be the 'SimpleObject'-Class. If you remove, or comment out, the ICustomTypeDescriptor interface from the class declaration then everything works ok.
Do you know this problem? Is there a solution or a work around?
Best regards,
Franziska
xaml:
| <telerik:RadGridView x:Name="gridView" |
| ShowGroupPanel="False" IsFilteringAllowed="False" AutoGenerateColumns="False" |
| ItemsSource="{Binding PmodCollection}" |
| AddingNewDataItem="gridView_AddingNewDataItem" > |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn Header="Test" DataMemberBinding="{Binding Test}" /> |
| <telerik:GridViewComboBoxColumn UniqueName="columnDescriptor" Header="Descriptor" |
| DataMemberBinding="{Binding SimpleObject}" DisplayMemberPath="Descriptor" |
| ItemsSource="{Binding SimpleObjChoiceList}"/> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |
| public partial class Window1 : Window |
| { |
| public Window1() |
| { |
| InitializeComponent(); |
| this.DataContext = new DataContext(); |
| } |
| private void gridView_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e) |
| { |
| e.NewObject = new SimpleObjectPMod(); |
| } |
| } |
| class DataContext |
| { |
| private List<SimpleObject> simpleObjs; |
| private ObservableCollection<SimpleObjectPMod> pmodCollection; |
| public DataContext() |
| { |
| simpleObjs = new List<SimpleObject>(); |
| simpleObjs.Add(new SimpleObject() { Descriptor = "bla" }); |
| simpleObjs.Add(new SimpleObject() { Descriptor = "fasel" }); |
| pmodCollection = new ObservableCollection<SimpleObjectPMod>(); |
| } |
| public List<SimpleObject> SimpleObjChoiceList |
| { |
| get { return simpleObjs; } |
| } |
| public ObservableCollection<SimpleObjectPMod> PmodCollection |
| { |
| get { return pmodCollection; } |
| } |
| } |
| class SimpleObjectPMod |
| { |
| public string Test |
| { |
| get; set; |
| } |
| public SimpleObject SimpleObject |
| { |
| get; set; |
| } |
| } |
class SimpleObject : ICustomTypeDescriptor
{
public string Descriptor
{
get; set;
}
#region Implementation of ICustomTypeDescriptor
public AttributeCollection GetAttributes()
{
return TypeDescriptor.GetAttributes(this, true);
}
public string GetClassName()
{
return TypeDescriptor.GetClassName(this, true);
}
public string GetComponentName()
{
return TypeDescriptor.GetComponentName(this, true);
}
public TypeConverter GetConverter()
{
return TypeDescriptor.GetConverter(this, true);
}
public EventDescriptor GetDefaultEvent()
{
return TypeDescriptor.GetDefaultEvent(this, true);
}
public PropertyDescriptor GetDefaultProperty()
{
return TypeDescriptor.GetDefaultProperty(this, true);
}
public object GetEditor(Type editorBaseType)
{
return TypeDescriptor.GetEditor(this, editorBaseType, true);
}
public EventDescriptorCollection GetEvents()
{
return TypeDescriptor.GetEvents(this, true);
}
public EventDescriptorCollection GetEvents(Attribute[] attributes)
{
return TypeDescriptor.GetEvents(this, attributes, true);
}
public PropertyDescriptorCollection GetProperties()
{
return GetProperties(null);
}
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
return TypeDescriptor.GetProperties(this, attributes, true);
}
public object GetPropertyOwner(PropertyDescriptor pd)
{
return this;
}
#endregion
}
{
public string Descriptor
{
get; set;
}
#region Implementation of ICustomTypeDescriptor
public AttributeCollection GetAttributes()
{
return TypeDescriptor.GetAttributes(this, true);
}
public string GetClassName()
{
return TypeDescriptor.GetClassName(this, true);
}
public string GetComponentName()
{
return TypeDescriptor.GetComponentName(this, true);
}
public TypeConverter GetConverter()
{
return TypeDescriptor.GetConverter(this, true);
}
public EventDescriptor GetDefaultEvent()
{
return TypeDescriptor.GetDefaultEvent(this, true);
}
public PropertyDescriptor GetDefaultProperty()
{
return TypeDescriptor.GetDefaultProperty(this, true);
}
public object GetEditor(Type editorBaseType)
{
return TypeDescriptor.GetEditor(this, editorBaseType, true);
}
public EventDescriptorCollection GetEvents()
{
return TypeDescriptor.GetEvents(this, true);
}
public EventDescriptorCollection GetEvents(Attribute[] attributes)
{
return TypeDescriptor.GetEvents(this, attributes, true);
}
public PropertyDescriptorCollection GetProperties()
{
return GetProperties(null);
}
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
return TypeDescriptor.GetProperties(this, attributes, true);
}
public object GetPropertyOwner(PropertyDescriptor pd)
{
return this;
}
#endregion
}