Silverlight 3 : Datagrid – Editing a cell shows a “Property set method not found.” message – Education Career Blog

I have a silverlight datagrid control bound to a Dictionary<string, string> with autogenerate columns set to true.

In the AutoGeneratingColumn event i change the column Header and IsReadOnly Properties as required(column bound to dictionary value is editable).

if ( string.Compare( e.Column.Header.ToString( ).ToLower( ), "key" ) == 0 )
                e.Column.Header = "Property Name";
                e.Column.IsReadOnly = true;
                e.Column.Header = "Property Value";
                e.Column.IsReadOnly = false;

All this works as intended but when i edit a cell and tab out i get a "Property set method not found." message next to the cell and it does not allow me to modify the grid after that.


A Dictionary<TKey, TValue> is contains a set of KeyValuePair<TKey, TValue> structures. Now that is the problem, the Key and Value properties are readonly, there is no Set, even if there were what is being edited will not be the same item that is held in the dictionary since structures are value types.

Bottom line is you can’t edit a Dictionary with the DataGrid. You will need to create your own class:-

public class PropertyItem
   public string Name { get; set; }
   public object Value { get; set; }

Then use something like ObservableCollection<PropertyItem>.

Leave a Comment