So my problem is as follows:
I am passing an object called Items of class MyClass into a new instance of MyWindow in WPF. And I am passing by value, not by reference. Then I bind certain controls (textboxes, comboboxes, etc.) of MyWindow to the properties of a new field called ItemsReplicate of MyClass that belongs to MyWindow and is made equal to Items. However, when I make changes to any control in MyWindow, Items's properties get overwritten too for some reason. Is this normal? Or am I missing out on something?
Here's the code description:
var passThis = (MyClass)myItem;
MyWindow wnd = new MyWindow(passThis);
public partial class MyWindow : Window
{
public MyWindow (MyClass _item)
{
InitializeComponent();
innerItem = _item;
this.DataContext = innerItem ;
}
private MyClass innerItem;
}
So in the end of this procedure, any changes made via binding affects both myItem and innerItem
Many thanks.
PS: Binding mode: Two-way