xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.9k stars 878 forks source link

PropertyGrid bind to Dictionary throw NotSupportedException on editor closing #1784

Open daihung opened 1 month ago

daihung commented 1 month ago

Hi,

I am experiencing an issue with the PropertyGrid when binding to a Dictionary<int, object>. The binding works correctly, and I can see the keys and values. However, when I open the values collection and then click OK/Cancel, a NotSupportedExceptionis thrown with the message: “Mutating a value collection derived from a dictionary is not allowed.”

Steps to Reproduce:

  1. Bind a Dictionary<int, object> to the SelectedObject property.
  2. Open the values collection in the PropertyGrid.
  3. OK/Cancel the changes.

Thanks.

XceedBoucherS commented 1 month ago

Hi,

Thank you for reporting this.

If you have access to the code, could you try to replace the content of internal void PersistChanges( IList sourceList ) from file Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControl.cs with the content of the attached file ? 1784.txt

to see if it help?

Thank you