I have a ContentControl in WPF which contains some input Controls, like TextBoxes and ComboBoxes.
Each of these Controls is databound to a given property in the ViewModel, with UpdateSourceTrigger=Explicit
.
When I click some "Submit" button, I want to traverse every Child of FormularioPaciente
that has bindings, and call UpdateSource
:
private void btnSalvarEditarPaciente_Click(object sender, System.Windows.RoutedEventArgs e) {
foreach (var childControl in LogicalTreeHelper.GetChildren(FormularioPaciente)) {
// what should I do now?
// I would really like to "auto-find" everything that should be updated...
}
}