I have a case of WPF binding I want to solve:
The issue is that I have a user detail screen and it has a employee combo box that gets filled with employees.
cbxEmployee.ItemsSource = DataAccess.GetCollectionView("Employee", "[Active] = True", viewModel.Context);
cbxEmployee.DisplayMemberPath = "FullName";
cbxEmployee.SelectedValuePath = "ID";
The binding in user detail screen xaml is for the user object, I just need the employee id to store in the int property.So no problems when the user selects an employee.
<ComboBox x:Name="cbxEmployee"
SelectedItem="{Binding Path=Employee,ValidatesOnExceptions=True}"
SelectedValue="{Binding Path=AssociatedEmployeeId}"
Style="{DynamicResource InputBaseStyle}"/>
Now the issue is that when an existing object is edited I need the combo box to get the correct employee to be shown,i.e the index should be set at the correct employee for the AssociatedEmployeeId of the user object.
Well how the heck should I do it ?
Any advice?