Reputation: 34818
Which control approach can i use to quickly provide visual editing of my List collection.
The in-memory collection I have is below.
My requirements are basically to:
My code
private static List<ConfigFileDTO> files;
public class ConfigFileDTO
{
private string filename, content_type, path;
private int file_size;
private DateTime updated_at;
public ConfigFileDTO() { }
public int FileSize {
get { return this.file_size; }
set { this.file_size = value; }
}
public string ContentType {
get { return this.content_type; }
set { this.content_type = value; }
}
public string Filename {
get { return this.filename; }
set { this.filename = value; }
}
public DateTime UpdatedAt {
get { return this.updated_at; }
set { this.updated_at = value; }
}
public string Path {
get { return this.path; }
set { this.path = value; }
}
}
Thanks
Upvotes: 2
Views: 392
Reputation: 1063649
If you only want the Path
column to be manipulated, then it is usually better to simply set up the column bindings (for things like DataGridView
) manually; however, you can also use things like [Browsable(false)]
(removes a property from display) and [ReadOnly(true)]
(treat a property as read-only even if it has a setter) to control how properties (/columns) are handled.
If you want to control how new instances are created, inherit from BindingList<T>
and override AddNewCore()
.
Upvotes: 2