0

I have a class with a public property for array of points

public System.Drawing.Point[] Points { get; set; }

I want user to be able to change this property using PropertyGrid.

Problem is that PropertyGrid allows me (user) to edit existing list of points.

enter image description here But if I want to add or delete points then I need to click "..." button on the right side of the row and open Point Collection Editor. enter image description here

I just don't understand why Point Collection Editor dialog shows me "Object does not match target type". What am I doing wrong?

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
walruz
  • 1,135
  • 1
  • 13
  • 33
  • can I clarify? "Using struct as key in dictionary" - there doesn't seem to be a dictionary here, and you don't seem to be using anything as a key... is the real question here: "why doesn't a `Point[]` work correctly in the default winforms collection editor?" – Marc Gravell Aug 10 '18 at 11:09
  • 1
    Possible duplicate of [Can't edit Point\[\] or List at design time](https://stackoverflow.com/questions/38561197/cant-edit-point-or-listpoint-at-design-time) – DeveloperExceptionError Aug 10 '18 at 11:09
  • 1
    it looks like the existing post that @DeveloperExceptionError linked to is a perfect fit here – Marc Gravell Aug 10 '18 at 11:11

0 Answers0