This is a migrated thread and some comments may be shown as answers.

Array vs List

2 Answers 138 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Maciej
Top achievements
Rank 1
Maciej asked on 27 Oct 2015, 02:06 PM

Hello,

I wonder if it is possible to work with lists and arrays in RadPropertyGrid in the same way. Maybe some example will clarify my problem:

At runtime I bind object of type shown below to RadPropertyGrid.Item:

public class ​SampleType
 {
        public int Id { get; set; }
        public string Content { get; set; }
        public int[] array { get; set; }
        public List<int> list { get; set; }
 }

List is initialized but empty, the same in the case of the array.

In GUI I can modify list property (add/remove items and modify their content), but array property cannot be modified in any way. I understand more static nature of arrays in .NET, but maybe it is possible to enable 'dynamic arrays' in RadPropertyGrid using some property or custom made extension method.

I would be most grateful if you would look into this matter as soon as possible and at least tell me if it is possible :).

 

Best Regards,

Maciej Nowicki

2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 30 Oct 2015, 01:12 PM
Hello Maciej,

The editing functionality of CollectionEditor should not be affected when you are using an array for its Source property. However, I am afraid that the add and remove functionalities of the control would not be possible to work with an Array class, as this conflicts with the basic concept of this data structure. Moreover, the control is not meant to provide functionality for such modifications.

So, I suggest you using a data structure that is dynamic in nature, instead of array. Would it be possible for you to elaborate on your obstacle to doing so?

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Maciej
Top achievements
Rank 1
answered on 30 Oct 2015, 02:37 PM

Hello Stefan,

Thank you for reply, now I know that I have to change arrays to lists everywhere I want to use given model in RadPropertyGrid and there is no less invasive method to deal with that problem. It is good to me, thanks once more.

 

Regards,

Maciej

Tags
PropertyGrid
Asked by
Maciej
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Maciej
Top achievements
Rank 1
Share this question
or