I have a setter for a list which is not firing. Adding a breakpoint doesn't even halt execution, it's like it's just not running the code at all. Any tips or advice on why it's not working?
private List<OrderLine> _orderLines = new();
public List<OrderLine> OrderLines
{
set
{
// Adding a breakpoint here has no effect,
// and the NotifyPropertyChanged function
// doesn't get called either
if (value != this._orderLines)
{
this._orderLines = value;
Recalculate();
NotifyPropertyChanged();
}
}
get
{
return this._orderLines;
}
}
...
// I am adding to the order lines like this
order.OrderLines.Add(line)
The setter will only be called if you use order.OrderLines = new List<OrderLine>()
then the setter will be called otherwise you get the Value from it with the getter.