C# WPF Tutorial #8 - Data Bindings using INotifyPropertyChanged

  Рет қаралды 48,238

Kampa Plays

Kampa Plays

Күн бұрын

Пікірлер: 92
@o0ODigoO0o97
@o0ODigoO0o97 6 ай бұрын
I usually do not stop to comment videos at all, but I must say it, this is one of the best tutorials I've watched in 17 years I've been in this platform. Magnificent, so to speak.
@ahshch
@ahshch Ай бұрын
This is the only video on whole youtube that explains the data binding perfectly. MVVM is very easy to understand if you know what is data binding and this video clearly explains it.
@demolishunDOTcom
@demolishunDOTcom 11 күн бұрын
Holy crap dude! You are the BOSS!!! Binding was driving me to insanity! Thank you!
@thomasmunguya2207
@thomasmunguya2207 9 ай бұрын
I love how you not only show what to do but also the best way to do it. There are so many tutorials out there which just show how to do something without taking into consideration the best way to do it, or let me say without taking into consideration best practices. The best part for me in this tutorial is how you made sure that we are reusing code and taking maintainability into consideration by making the OnPropertyChanged method get the calling member name by itself.😅 By the way, I just learned about the CallingMemberNameAttribute right from this tutorial. Keep it up.👍
@KampaPlays
@KampaPlays 9 ай бұрын
Thanks! I like that one too! C# has a lot of cool tricks like that (sometimes dangerous though!)
@AntonioCorneal
@AntonioCorneal Ай бұрын
Maaaannn I've been trying to grasp that relationship between bindings and the properties for like a year on and off😅 You gave the perfect simple example for it to make sense! Thank you!
@manibaghdadi725
@manibaghdadi725 8 ай бұрын
Literally the best wpf tutorial on the internet. I love it 🔥
@KampaPlays
@KampaPlays 8 ай бұрын
Thanks so much!
@MatthiasS-jp5uu
@MatthiasS-jp5uu Ай бұрын
god im so happy i found this video, i started with wpf and i was lost from the beginning, some of my co workers even sayed that if you make a grave mistake its easyer to start fresh. but now everything is starting to make sense. thanks for that playlist your a Hero.
@edinetgrunhed6000
@edinetgrunhed6000 Жыл бұрын
it explain more simple than the books I've read, more concise and direct to the point explaination
@KampaPlays
@KampaPlays Жыл бұрын
Thanks so much!
@mumk
@mumk 2 ай бұрын
Crazy stuffs, this is exactly what I need to improve my small program, it was invaluable and I cannot express my gratitude enough!!!! Thank you!
@MrSharksk
@MrSharksk Ай бұрын
Mannn !, what an explanation , data bindings look so much easier right now for me, thank you !!
@qwerty3000
@qwerty3000 Жыл бұрын
Databindings used to confuse me, but you've just made it so simple to understand. Big ups, man!
@KampaPlays
@KampaPlays Жыл бұрын
Awesome!! Glad to help!
@wtsharpproductions
@wtsharpproductions 8 ай бұрын
A literal, genius and expert on code. Definitely understands what's going on 'prior to' and during 'runtime' ... No cap given. And, I've watched a lot of C++/C# tutorials prior to this... "The instruction is truly ABOVE par here." Thank you, Brother! @Kampa Plays ...Let's GO ! VIBES !! 🔥🔥🔥
@KampaPlays
@KampaPlays 7 ай бұрын
Thank you, really appreciate that!!
@junulee3584
@junulee3584 Жыл бұрын
Best WPF tutorial among I've found so far. Thank you so much.
@KampaPlays
@KampaPlays Жыл бұрын
Great, thank you!!!
@dzendys_
@dzendys_ Жыл бұрын
I agreee, I was totally lost, when i saw OnPropertyChanged() in someone's other tutorial.This video has helped me to finally understand it well and how it works in the background. Not the classical: "okay, so this does that and when does this happen, this will be called and this will happen". Thanks
@RaqiGirl
@RaqiGirl 10 ай бұрын
Here I am again. Thirty-five years ago I went to college to learn all I could about programming. We were just starting to talk about object-oriented programming at the time and trying to learn the basics. Thirteen years ago I retired and went on to other things, such as traveling N. America in an RV. Recently I've wanted to write some code to watch our investments while we play here in Panama and at seventy-five have decided to "dust off the brain" and start learning a current, object-oriented language. After a few months of looking around I liked what I saw in C# and have begun learning. After looking at some other teachers and their tutorials I liked what I saw with @KampaPlays. I just hope now that I've found a teacher that you are able to keep up with me! 😁
@KampaPlays
@KampaPlays 9 ай бұрын
This is so great. It sounds like you are living the most out life! C# is a great OO language. It is extremely versatile, and while it has great high level features like garbage collection, it can also get about as low level as you want it to, without getting into assembly. Happy coding!
@ebvs5ou
@ebvs5ou Жыл бұрын
Absolutely great set of tutorials ! Very well structured. Thank you very much. Really usefull small tipps now and then like "propfull"
@KampaPlays
@KampaPlays Жыл бұрын
Great, thank you, glad it's helpful!
@pierrestcergues
@pierrestcergues Жыл бұрын
ouah! I had to watch it couple of times, but now it's crystal clear.. thanks!
@KampaPlays
@KampaPlays Жыл бұрын
Awesome! Glad it made sense!
@owenschaff292
@owenschaff292 Жыл бұрын
This series is great and databindings seem amazing, cant wait to see all the ways they can be used!
@KampaPlays
@KampaPlays Жыл бұрын
Thanks! They are pretty awesome. Soon we'll do some MVVM and put them to use really well.
@flaric590
@flaric590 9 ай бұрын
You're tutorials are fire!🔥
@KampaPlays
@KampaPlays 9 ай бұрын
Thank you!!
@根本花里子
@根本花里子 Жыл бұрын
The topic seemed pretty complex, but I was able to understand it, thanks to your brilliant explanation!
@KampaPlays
@KampaPlays Жыл бұрын
Really appreciate that!!!
@根本花里子
@根本花里子 Жыл бұрын
Ooooh, that is genius! Thank you very much for your amazing content!💖
@KampaPlays
@KampaPlays Жыл бұрын
Thank you, glad to help!
@wookyumkim4669
@wookyumkim4669 Жыл бұрын
10:48 Oh, I can't wait for the video about DataGrid 😂😂
@KampaPlays
@KampaPlays Жыл бұрын
Won't be long from now, will be doing ListView as well!
@FionaldyAManik
@FionaldyAManik Жыл бұрын
BROOOO YOU'RE SO SMART, THIS IS SUPER HELPFUL!!!!!!!!!!!
@KampaPlays
@KampaPlays Жыл бұрын
Glad it's helpful, thank you!!
@thomasaminer
@thomasaminer 6 ай бұрын
Thank you. Now I understand how attributes work (I hope so)🙂
@DharmikGohil-bw2ug
@DharmikGohil-bw2ug Жыл бұрын
Really Great explanation Thanks 👏
@KampaPlays
@KampaPlays Жыл бұрын
Thank you!
@bkoliver
@bkoliver 6 ай бұрын
I have a stupid question, if I'm making four of these clearable text boxes, how do I add a variable that changes between the different boxes. the variable Boundtext works fine, but I am having trouble that each time I'm updating box 2-4, bound text is getting overwritten, I've tried referencing the clearabletextblock x:Name, but it's saying it can't convert that to a string. I know I'm missing something stupid.
@jonathanmoore5619
@jonathanmoore5619 8 ай бұрын
Great video. Can i just ask DataContext = this.... Does that mean that the data associated with this wpf project.. is set and written within MainWindow? And could be set to another class, if you want? And what about if you have data in main window and an external or within project namespace class? How do you do that?
@KampaPlays
@KampaPlays 7 ай бұрын
Yes, and yes! Generally when you do this you create a "ViewModel" and assign the data context to that, separating your UI from your logic (very similar to controller in MVC). Tutorial #23 goes over the basics of creating and using one.
@jonathanmoore5619
@jonathanmoore5619 7 ай бұрын
@@KampaPlays thank you.
@unkxxwn_name
@unkxxwn_name Жыл бұрын
I think I might got lost somewhere, its 3 AM, just yesterday I learned how to print Hello world on the console and now I am here
@KampaPlays
@KampaPlays Жыл бұрын
Haha! That is awesome!! Everything making sense and sticking with you?
@priyankaabbineni4231
@priyankaabbineni4231 Жыл бұрын
Could you please do a video on wpf treeview controls in MVVM pattern and how to add data dynamically to treeview
@KampaPlays
@KampaPlays Жыл бұрын
Will add this to my list! thanks!
@furiouslobster7912
@furiouslobster7912 Жыл бұрын
Hey, you've mentioned several times "gooe"(?). Do you mean GUI or is it something else. English isn't my native language so it got me quite confused lol
@KampaPlays
@KampaPlays Жыл бұрын
Yes, I'm saying "GUI", sorry for the confusion!
@yadmhedin972
@yadmhedin972 9 ай бұрын
the best tutorial love you man
@KampaPlays
@KampaPlays 8 ай бұрын
Thanks! Much love!
@mjmo6919
@mjmo6919 Жыл бұрын
Very nice tutorial
@KampaPlays
@KampaPlays Жыл бұрын
Thank you!!!
@wms_ll
@wms_ll 6 ай бұрын
Ты очень классно рассказываешь,🤟
@Silent-Scandals
@Silent-Scandals 6 ай бұрын
getting error Error (active) CS0103 The name 'InitializeComponent' does not exist in the current context How to fix this this basically i have created custom component and all file showing this problem?
@potassiumzx
@potassiumzx 2 ай бұрын
Hi, I got the same problem in VS Code. That is a false warning shown by C# Dev Kit extension. Currently, there is one temporary way to fix it. You have to put " True " (without the quotation marks) in your csproj file. Note that the path of MainWindows.g.cs could be different in your project so make sure to check it. This is for VS Code. I don't know if this will work on VS (Visual Studio) or not.
@vitalijgrabovan2061
@vitalijgrabovan2061 Жыл бұрын
Hello Krampa, I have one issue and it seems that I can’t find the answer on it, so I hope that you might help :) In my MainWindow I have a radio button with a XAML tag="*" in my MainWindow I can see that this tag has "*" as a parameter. The problem is that when I want to pass this Radio Button with that tag to my different class "MyClass" the tag name is empty="null" why it’s not passing? What do I need to do to pass the parameters from MainWindow to MyClass, is it done by Data Binding? Thank you.
@KampaPlays
@KampaPlays Жыл бұрын
It depends on the purpose of your other class. You might want to check out tutorial #23, It goes over ViewModels, which use databindings to get data from the UI to another class automatically -- that may be what you are needing. If a ViewModel-type interaction is not what you are after, I would recommend creating some state variable or object to represent your radio button(s) states and any other UI states, and do not pass the actual UI controls anywhere. For example, when your radio button state is changed (or other event): string radioTag = yourRadioControl.Tag; otherClass.Update(radioTag)
@vitalijgrabovan2061
@vitalijgrabovan2061 Жыл бұрын
@@KampaPlays Thanks I will try it :) I have solved this issue by adding a constrution in my class that i need to get a radio button Tag in and passed that value to it. Works quite good but I think its not the best solution.
@vitalijgrabovan2061
@vitalijgrabovan2061 Жыл бұрын
@@KampaPlays So I did watch your 23th video for several time to understand all of it and at the end I have solved my problem :) thanks your the best !!!
@KampaPlays
@KampaPlays Жыл бұрын
Awesome!!! Thanks for letting me know!
@Onyx31415
@Onyx31415 Жыл бұрын
Hi, I really love the series so far. Why, do you create a public and private property for BoundText?
@KampaPlays
@KampaPlays Жыл бұрын
Thanks!! The public property requires a private backing variable to store the data. The property really only acts as a "getter" and "setter" of that private variable. Even if you create an auto-property (e.g. public string Text {get;set;}), the compiler will create this private backing variable for you. Here we need a full property, mainly so that we can define our PropertyChanged behavior in the property's set method. Does that answer your question?
@Onyx31415
@Onyx31415 Жыл бұрын
@@KampaPlays Ah, I'm a bit new to c# and didn't know it worked that way behind the scenes. Thanks a lot for your answer
@KampaPlays
@KampaPlays Жыл бұрын
No problem, great question!
@azadalmohammad-rm7we
@azadalmohammad-rm7we Жыл бұрын
Keep up the Amazing Work!!
@KampaPlays
@KampaPlays Жыл бұрын
Thank you!!
@nguyenmanh6751
@nguyenmanh6751 Жыл бұрын
thanks you very much
@KampaPlays
@KampaPlays Жыл бұрын
Welcome!!!
@standman007
@standman007 7 ай бұрын
100 likes for this tutorial. Thanks
@KampaPlays
@KampaPlays 7 ай бұрын
Thank you!!
@wookyumkim4669
@wookyumkim4669 Жыл бұрын
8:30 😆👏👏👏👏👏👏👏👏
@AhmadAnwar31Aan
@AhmadAnwar31Aan Жыл бұрын
👍👍👏❤
@KampaPlays
@KampaPlays Жыл бұрын
🥳
@tsunamio7750
@tsunamio7750 Жыл бұрын
10:18 Have you ever heard of side-effect-programming? Please, end my suffering. I mean, WPF is easy... you just have to learn everything, and it does not apply to any other language or any other tool. This is pure horridness. Death shall feel good once I'm off this acursed playground of slow, bloated corporate shit.
@KampaPlays
@KampaPlays Жыл бұрын
Ha! Yes, there is a lot of behind-the-scenes 'black magic' that WPF (and so many other UI frameworks) does that I'm not a fan of. The suffering is extra real when you are forced to use strategies and patterns when they aren't necessary. They can be very useful in the right context, but if reasonable, save the separation of concerns worries and give me my visible, readable, and readily traceable code all day. I hope your suffering wanes, best of luck out there.
@tsunamio7750
@tsunamio7750 Жыл бұрын
@@KampaPlays Hey, I just made a whole Kanban UI. I'm delving into the MvvM. It's not so bad. I can't thank you enough. Once I get back to work, First salary, first tip for you
@nubdevice4412
@nubdevice4412 Жыл бұрын
Umm what? Screw placeholder? Fine I accept defeat. Guess I'm going to just set it like I'm told not to.
@KampaPlays
@KampaPlays Жыл бұрын
Sorry I don't understand, which part are you referring to?
@nubdevice4412
@nubdevice4412 Жыл бұрын
@@KampaPlays it's okay. I was a little disappointed this episode didn't apply well with the previous. Sucks being dumb.
@KampaPlays
@KampaPlays Жыл бұрын
Ha! I bet you are not dumb! This part of WPF can be really hard to get because so much of it happens like "black magic" behind the scenes. I tried breaking it up to best understand what is happening, but maybe it just wasn't how you needed to see it. So I think I understand now, but if not let me know. The previous video we set the control's property directly, which was a placeholder instead of implementing "OnPropertyChanged". I wanted the last videos focus to be on how to make a custom control and not pile on the bindings portion. So in this video, it shows how to implement the interface INotifyPropertyChanged so that you do not have to set the control's property directly, but instead call "OnPropertyChanged" to let it update via binding. I hope this helps!!
@anonstrider9136
@anonstrider9136 3 ай бұрын
@@KampaPlays The previous episode had clearable texboxes and watermarks, however when i set up the onpropertychange the watermarks dont show anymore
@SpeedSharp23
@SpeedSharp23 Жыл бұрын
Hi there. I've been learning how to code in c# for about 5 months now and decided I'd like to try adding GUI to my console applications. I found this playlist and I have to say...This is great. Simple to understand and easy to follow. However, there's one thing I just can't seem to understand. By using INotifyPropertyChanged and implementing PropertyChanged event, and then invoking it inside the setter of property, we can notify GUI about property change. What I don't understand is, if I'm not mistaken, when we invoke the event, event handler methods that are subscribed to the invoked event are supposed to start and they are supposed to do the logic part. But if I'm looking at the code right, you never created an event handler method that subscribes to the PropertyChanged event, so PropertyChanged event value should be null/nothing should happen, and yet PropertyChanged?.Invoke(...) worked. Am I missing something, or are event handler methods for PropertyChanged event already built-in, similarly to how events like Click seem to have built-in event invoking method? In other words, I'm trying to understand why PropertyChanged != null; at invoke time. Sorry for this long of a message. Hopefully, you understand what I'm asking, since english is not my first language.
@KampaPlays
@KampaPlays Жыл бұрын
Great question, and you are right. INotifyPropertyChanged and the PropertyChanged event does work a bit differently than a user-defined event, in that it is already "hooked up" for you for any compatible UI elements in your data context. All you need to do is implement the interface, and invoke the event telling it which control to notify, and the rest is done in the background.
@SpeedSharp23
@SpeedSharp23 Жыл бұрын
@@KampaPlays Nice. Shortcuts like these really make programming easier, but they also tend to confuse me when I'm trying to learn something 😅. In any case, thanks for your help 😊.
@KampaPlays
@KampaPlays Жыл бұрын
@@SpeedSharp23 Totally understand that. While I'm used to most of the "black magic" behind-the-scenes WPFisms, I prefer to see the logic myself! Glad to help!
@deezburr
@deezburr 5 ай бұрын
oh hell nah this is where i get lost 😭
@MonderMurshed
@MonderMurshed 3 ай бұрын
How are you know ? did you moved on ?
@wms_ll
@wms_ll 6 ай бұрын
Best WPF tutorial among I've found so far. Thank you so much.
C# WPF Tutorial #9 - MessageBox
5:17
Kampa Plays
Рет қаралды 22 М.
The Basics of Data Binding in WPF
20:53
Tactic Devs
Рет қаралды 49 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
WPF INotifyPropertyChanged and Databinding
14:30
Payload
Рет қаралды 42 М.
C# WPF Tutorial #7 - Custom Textbox Control
13:25
Kampa Plays
Рет қаралды 53 М.
Most Common Crashes and Memory Leaks with C++ Vectors
45:40
C# WPF Tutorial #23 - Using ViewModels in MVVM
15:02
Kampa Plays
Рет қаралды 28 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
WPF in C# with MVVM using Caliburn Micro
1:23:30
IAmTimCorey
Рет қаралды 367 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН