I have a UserControl that I want to use to edit data in a DataGrid. The UserControl has a TextProperty that I use for binding. When editing a cell, the content of the TextProperty is displayed. But when leaving the edit mode, the TextPropery of my item is not updated.
Here I found a solution: C# Wpf Editing Datagrid does not update it's itemsource
For a TextBox this binding is working.
factoryTextBox.SetBinding(TextBox.TextProperty, new Binding("Title"));
But for my CustomTextBox it only works with setting mode to TwoWay mode.
factoryTextBox.SetBinding(CustomTextBox.TextProperty, new Binding("Title") {
Mode = BindingMode.TwoWay // <--
});
Why do I need TwoWay for my user control, but not for TextBox. Do I miss something?