Code Red > .NET

WPF Binding is making me lose my mind

<< < (2/2)

Jeff_M:
Norman, I had to use your first suggestion. Number 2 throws an error at loading due to the Binding unable to use a read only property. I changed it to a OneWay binding and it never updates the textbox. It is working fine with the get/set TextToDisplay so I'm happy, just wondering why the second option isn't working.

n.yuan:
I think that when the UI is loading your data MOdel (_model) is null, so, the readonly property for binding (in the option 2) actually should be:

public string TextToDisplay=>_model==null? "" : _model.OutputString;



Jeff H:
WPF use to piss me off also, but after doing some ASP web apps, and some node/express apps it clicked and then makes sense. Many of the documentation and examples just assume you have MVM MVVM experience.

CADbloke:
https://github.com/Fody/PropertyChanged Changed my WPF life. I use it always, for years, even donate monthly to them.

Navigation

[0] Message Index

[*] Previous page

Go to full version