Объект из БД в WPF
Имеется объект WorkingTime:
public partial class WorkingTime
{
public int EmployeeID { get; set; }
public System.DateTime TimeStart { get; set; }
public Nullable<System.DateTime> TimeEnd { get; set; }
public virtual Employees Employees { get; set; }
}
И объект Employees
public partial class Employees
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Employees()
{
this.WorkingTime = new HashSet<WorkingTime>();
}
public int ID { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<WorkingTime> WorkingTime { get; set; }
}
На форме задаю значения TimeStart и TimeEnd при помощи 2-ух DatePicker и 2-ух TextBox. Employees выбираю из ComboBox:
<DockPanel LastChildFill="True" Margin="0,5">
<Label Content="Сотрудник:" Width="140"/>
<ComboBox ItemsSource="{Binding AllEmployees}" SelectedItem="{Binding WorkingObject.Employees}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}"/>
<Label Content="{Binding Surname}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
Почему при выборе WorkingTime.Employees значение WorkingTime.EmployeeID не выбирается из Employees.ID?