I am dynamically creating rows using a Grid, which is a nested GroupBox, which has these custom TextBoxes. I bind it to my Rod class, but tried to change the fields of the TextBox.Text does not change the fields of Rod
public RodTextBox(string text,string propertyName, Rod rod)
{
Text = text;
TextWrapping = TextWrapping.Wrap;
addBinding(propertyName ,rod);
}
public void addBinding(string propertyName, Rod rod )
{
Binding myBinding = new Binding($"{propertyName}");
myBinding.Source = rod;
myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
myBinding.Mode = BindingMode.TwoWay;
SetBinding(TextBlock.TextProperty, myBinding);
}
}