I wish to create custom control with Items property.
Is it safe to return class ItemColection that implements IList<Item>, because i didn’t saw this in any prebuilt controls?
What’s the best way to implement this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no problem to create a property of type inherited from ILIst for a control. But if you are building a control it’s better to make your property editable with PropertyGrid in design time. To make it editable you should create your own collection of items inherited from CollectionBase and create a property of that type.
Check out this article: Creating a Custom Collection for Use in a PropertyGrid
And after that don’t forget to make your Items property editable in design time by setting appropriate attributes: