Information générale
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
ComboBox ItemsSource data dilemma?
I'm going to use a particular ComboBox very often in my app... A lookup ComboBox control that that has ItemsSource set to a colection of objects that are EmployeeID's and EmployeeNames, with SelectedValuePath and DisplayValueMember set to the obvious setting just mentioned fields, and then I will have it using the SelectedValue property to get/set the actual field value in the Linq-to-Sql model.
Obviously, the point of this is the very common practice of storing the EmployeeID as a foreign key in a record, using the ComboBox to limit the user to only valid choices.
However, how do you deal with the fact that when an employee is terminated, they are not a valid choice any longer to choose for a new record, but you must still display there name for records that were made when they were an active employee?
On the one hand, my ItemsSource collection must be complete with ALL employees in order for the UI to display the employee name for older records, but then other hand it only needs to have a list of ACTIVE employees when the UI is in "add mode" or maybe even "edit mode".
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement