In my WPF DataGrid there is short list of phone numbers for a contact. I want to allow ONLY ONE of the numbers to be marked as preferred.
The view model has a property for the contact (an entity from the database) and an ObservableCollection of related PhoneNumbers, also from the database. Simplified PhoneNumbers entity looks like this:
class PhoneNumbers
{
[Key]
public int ID { get; set; }
public string PhoneNbr { get; set; }
public bool Preferred { get; set; }
public int ContactID { get; set; }
}
The DataGrid displays the PhoneNbr property in a DataGridTextColumn and the Preferred property in a DataGridCheckBoxColumn; the other properties aren't displayed.
In an ideal world, when the user checks a phone number in the DataGrid, all the other numbers would automatically be UNCHECKED. Right now I have no control over this - they're free to check any or all of them.
So...I'm looking for guidance in how to make this happen. Thanks