Hello, I'm wondering how you guys would solve this problem. I have following class
public class MyTask
{
public int CustomerID { get; set; }
public int ProjectID { get; set; }
}
public List<Project> AllProjects { get; set; }
public class Project
{
public string ProjectName { get; set; }
public int CustomerID { get; set; }
}
Now at program-start, I load all available Projects into "AllProjects". Then I bind the Collection to a ComboBox, where a User first has to enter the CustomerID and depending on that, the ComboBox for Projects changes. What's in your opinion the best way to do that? Using a CollectionView for each MyTask?
What I'm doing right now is have in MyTask a List AvailableProjects, which gets changed each time when the MyTask.CustomerID is changed.. e.g.
public int CustomerID {
get { return _customerID; }
set { _customerID = value; UpdateAvailableProjects(); }
}
private void UpdateAvailableProjects()
{
//Loop trough static.Main.AllProjects and check if Project.CustomerID == this.CustomerID);
}
Thanks for any help.
Cheers