So I have built quite a few custom controls and I have been having problems with controls that have types of System.Collections.Generics.Lists<>() in them. Basically they are caching their results into a resource file and saving my main form’s designer code to reference the resource file instead just being a normal list.
The List<> is getting populated from a WCF data source way after runtime.
This is becoming a problem because I have code that fills a listview on the set methods of those properties. So how can I tell my control not to cache the results of my properties. I assume I would have to first telling it to cache results but I am not.
My properties look like this in the control.
private List<Job> _jobs;
public List<Job> Jobs {
get { return _jobs; }
set { _jobs = value; }
}
Then they are getting set like this in my Main’s forms designer code.
this.customControl.Jobs = ((System.Collections.Generic.List<Jobs>)(resources.GetObject("customControl.Jobs")));
I have asked a pre-cursor to this question here
Try to add this attribute on your property :