🤩🤩 Yes!! This is what I wanted to know! You always present the core stuff concisely! It seems that I can apply this lesson to my toy project which has DataGrid with ItemSource. The logic and principle may be same with List. ☺☺ Thank you very much as always!! 😄😄
Thank you!! You can use List as an ItemSource binding with DataGrid but it will not automatically notify on all collection operations like an ObservableCollection will. You can use ObservableCollection with DataGrid, though!
Don't you think about to make a course for Udemy? I'm not english speaker but can understand and you make it so easy to learn the concepts. Btw, thanks so much for this videos!
Love your videos. So far the clearest explanation of data binding, ObservableCollections, etc. that I have found. In this exercise, is there a disadvantage to initializing the collection when it is declared (instead of in the constructor)? private ObservableCollection entries = new();
Thank you so much, I really appreciate that! In this case, I don't think there are any real disadvantages to doing that. Basically either way, you are creating the collection on class instantiation (generally its safe to assume the constructor will run first, anyway). I do this occasionally, depending on the object's purpose/scope. I wouldn't get into a habit of always or blindly initializing in the declaration though, because often times you will end up creating objects well before you need them, spending memory unnecessarily, and increasing the time it takes to create your class. Creating the objects when you need them (lazy initialization) can increase performance a good bit at scale. Hope this helps!
Thanks for the video. Really helpful. I have a question here we are using binding but we are taking text box entry (That we are adding on button click)from GUI i.e., It we are not running independently right. Please correct me if i am wrong.
Correct - trying to sprinkle in a bit of functionality over time as to not overwhelm -- developing the UI truly independently would use all bindings, and likely incorporate the MVVM pattern in doing so.
I am programing in React a lot and there we have useState hook. UseState automaticlly refresh your view when it has been changed. Obsevarble collection I understand works similar. Correct me if I think wrong.
I checked like 3 times that I did it exactly as you, but my ListView stays empty after manually adding items `Entries.Add("Test")` in the Constructor of the binding class.
Hm. Make sure you have set your datacontext, InitializeComponent is called first, and double check your spelling/capitalization on your binding. These are common things that might be your issue.