C# WPF Tutorial - Using INotifyPropertyChanged

  Рет қаралды 49,687

ToskersCorner

ToskersCorner

Күн бұрын

Пікірлер: 85
@ToskersCorner
@ToskersCorner 6 жыл бұрын
After re-watching this video to accurately remake the application for those of you who would like the code source, I felt the need to make a comment. Keep in mind when watching this video I wanted to stay more focused on things relevant to the INotifyPropertyChanged.. so there are many things in this video that I would NOT recommend for the functionality we were creating. I chose to write the application the way I did for the sole purpose of emphasizing the focus of the video, and not to demonstrate anything but that. Hence why I avoided DataContext binding, Commands, etc.
@ranavitaln
@ranavitaln Жыл бұрын
Your tutorials are amazing! Simple, structured and not too overwhelming!!!
@bkkrisi5477
@bkkrisi5477 2 жыл бұрын
Your Videos are great. The rate is perfect, and your explanations are clearly defined. Thank you :)
@ukaszzelechowski6493
@ukaszzelechowski6493 4 жыл бұрын
Hello, I'm from Poland. Very good job. 30 minutes of your courses learned me more than paid courses in my language. Finally i understand what it is binding. :D
@jameslombard5698
@jameslombard5698 5 жыл бұрын
Sound is very soft, but nice clear and simple example. Easy to follow and understand. Thanks.
@CanadianMang
@CanadianMang 3 жыл бұрын
Thank you so much for these tutorials. You are one of the very few that actually explain WPF and databinding in detail. Most people just rush through tutorial without explaining the details.
@AZOHA
@AZOHA 5 ай бұрын
Really nice and smooth tutorial
@native-nature-video
@native-nature-video 2 жыл бұрын
Thank you for such a clear example!
@Sebastian-lh6bn
@Sebastian-lh6bn 6 жыл бұрын
Just discovered your tutorials and really got to admit, they are brilliant.
@BenedictoAlvarez
@BenedictoAlvarez 7 жыл бұрын
Take a break from the tutorial of the vending machine because I did not understand the inotifypropertychanged I hope with this tutorial I became clearer. Thanks for your tutorials
@ronancasey
@ronancasey 7 жыл бұрын
Same with me. How is WPF going for you?
@BenedictoAlvarez
@BenedictoAlvarez 7 жыл бұрын
I need the code because not working for me :(
@ronancasey
@ronancasey 7 жыл бұрын
It's in the link in the description.
@ToskersCorner
@ToskersCorner 7 жыл бұрын
If you guys haven't checked out my notepad wpf tutorial, I think you should. It takes a few steps further than the vending machine tutorial.
@MonderMurshed
@MonderMurshed 2 ай бұрын
The first video was really good, but i found this one to be so difficult for me, but thanks for the information.
@piak15
@piak15 4 жыл бұрын
Your tutorials are beyond amazing! Simple, structured and not too overwhelming. I need this for my studies rn. Thanks alot man!
@fastscript1343
@fastscript1343 2 жыл бұрын
True
@bouncebounce5549
@bouncebounce5549 8 жыл бұрын
Hi Tosker. Instead of typing the method name in the events property dialog, you can simply double-click the empty field and it will appropriately name and create the method in code behind. You mentioned looking for a better way in the video, so I hope that helps.
@ToskersCorner
@ToskersCorner 8 жыл бұрын
Thank you very much for the response. I do know that it will automatically name it. I was unsure if there was a way to create multiple events at once without the need to go back and forth from the event window to the code-behind. Thank you though, because I should have mentioned what you just said in the video for beginners to know of this feature. Hopefully they'll see this comment.
@eitzhadas
@eitzhadas 7 жыл бұрын
Typing "Click=" in the XAML and hitting Tab twice should automatically create the event in the code behind and its name automatically populated in the XAML. F12 then brings you direct to the code behind.
@ToskersCorner
@ToskersCorner 7 жыл бұрын
Thyanks!
@JymMorton
@JymMorton 7 жыл бұрын
Double click the button in the Designer (VS 2017) adds the xaml and code behind for the click event.
@Fannypacksnkittens
@Fannypacksnkittens 3 жыл бұрын
Thank you so much!! These videos have been so helpful for me!
@67Keldar
@67Keldar 3 жыл бұрын
Awesome… loving your videos 👍
@80amnesia
@80amnesia 5 жыл бұрын
basic (very important), clean, clear and simple examples. Thanks
@noclicheplease
@noclicheplease 7 жыл бұрын
Thumbs up for the pleasant sound of that mechanical keyboard. And thanks for this useful tutorial.
@ToskersCorner
@ToskersCorner 7 жыл бұрын
Preetham S Gowda Thanks for the comment. Glad you like the mechanical keyboard sound as well. I myself find the noise very therapeutic. Would never own anyother type of keyboard!
@mohamdalmhde1322
@mohamdalmhde1322 4 жыл бұрын
Amazing Tutorial!! Thank you so much!
@martinlym7511
@martinlym7511 2 жыл бұрын
Hope someone can answer this, why does the text change in response to the button being pressed when the button isnt even connected to that textbox? I've also noticed it changed when you press the background buttons. Thanks ToskersCorner, awesome tutorial!!!!
@MisterThug187
@MisterThug187 5 жыл бұрын
What a genius , great Job Joe
@Whoisemmanuel
@Whoisemmanuel 7 жыл бұрын
You probably already know this but in case not. To create a full property fast you can use propfull and then hit tab twice.Thanks for making these videos I recently got a job that uses WPF and your notepad videos helped to fill in some gaps of knowledge.
@studstud5498
@studstud5498 7 жыл бұрын
Oh after few minutes the videos were clear.
@randypenajimenez3893
@randypenajimenez3893 2 жыл бұрын
Is it recommended that model implements INotifyPropertyChanged?
@nero1988
@nero1988 3 жыл бұрын
What is the point of having viewmodel MVVM when you dont use commands but code behind window
@juanclopgar97
@juanclopgar97 3 жыл бұрын
how you know when you have to use Window Datacontext or "local" datacontext, (in the control itself)
@supercreate4
@supercreate4 4 жыл бұрын
If i include second property in PersonViewModel class then how can i initialized them
@JymMorton
@JymMorton 7 жыл бұрын
I see in xaml there is a DataContext="". Is it not possible to set the colour with that instead of using the Click Event? (I guess I could actually type out your project and see for myself but I thought I'd ask first)
@lionciomorcilla3045
@lionciomorcilla3045 3 жыл бұрын
THANKYOU SOMUCH!
@jackdaniels2160
@jackdaniels2160 4 жыл бұрын
Your Tutorial is great. Very helpfull. But your voice is very silent. So... a bit louder would be helpfull. ;)
@cyukore1796
@cyukore1796 7 жыл бұрын
very nice tutorial
@Cortexikid
@Cortexikid 5 жыл бұрын
Hi! First of thanks for these videos I learn a lot from them! I have a question now, at 8:45, in PersonViewModel, OnPropertyChanged is called and a string was passed as the parameter but I don't get why it is "Name" (with quotation marks) and not just simply Name?
@petarjukic6841
@petarjukic6841 4 жыл бұрын
I believe the name of the changed parameter is meant to be passed, thats why it's "color" and "name"
@edouardpoitras810
@edouardpoitras810 Жыл бұрын
If you look at INotifyPropertyChanged, you will see that NotifyPropertyChanged takes a string as its argument.
@windowsbuilderthegreat3121
@windowsbuilderthegreat3121 3 жыл бұрын
You should do a video on user control inheritance
@zubair007khan
@zubair007khan 4 жыл бұрын
Crud App please
@vvalentinee168
@vvalentinee168 4 жыл бұрын
Thank you!
@portaautomat8558
@portaautomat8558 7 жыл бұрын
hi. Thanks for video! very nice. I have one question. Why did you create PersonViewModel and BackgrounViewModel classes ? In normaln MVVM way it shouldn`t be PersonModel and BackgroundModel instances in MainWindowViewModel ? By making more viewmodels classes (like thouse two) it is more complicated. Could you be so nice and explain it to me ? thanks
@ToskersCorner
@ToskersCorner 7 жыл бұрын
MVVM is just a pattern, and you can make your own judgment calls for the most part. In this video, I just wanted to demonstrate using the INotifyPropertyChanged. This would also depend on how you are building the application. Some people prefer notifying property changes in the view model, and some prefer it in the model. I usually prefer the view model, which is why in the case I used view models.
@ToskersCorner
@ToskersCorner 7 жыл бұрын
This depends on the binding. If you notify the property change of the model object only, then when you change it's 'Name' or 'Age' values, the view wont be notified of this. In this case the view would only be notified if the actual 'PersonModel' has been directly set, rather than its inner properties. I hope I am communicating this clearly.
@jayjayjaythebrand
@jayjayjaythebrand 7 жыл бұрын
Was your site hacked? Looks like the source code isnt available for download anymore.
@mr.es1857
@mr.es1857 7 жыл бұрын
Tosker i need you help!!!, it happens to that when i run my program works well i think because it binds to the text block the contenent of the get method of the textbox correctly but when i change the content of the textbox the text block information is the same as it was. get { //if (string.IsNullOrEmpty(_userBox)) /// return "my Friend"; return _userBox; } set// set method - what is wierd to me that the "my Friend " text is binded correctly!
@ToskersCorner
@ToskersCorner 7 жыл бұрын
DOSESTACIONES2E have you tried changing the binding mode of the textbox xaml to "TwoWay"?
@mr.es1857
@mr.es1857 7 жыл бұрын
well think i was in OneWayToSource i don´t remember know and i solved the problem making a property of the label and notifing but i dind´t like it because i don´t think that that little thing that could take the source from the text box entersmy view model to make it little larger. Soo i was trying to the way you did and i was not using a twoway because if "My friend" was the default text on the label making it twoway, the textbox showed "my friend" too instead of the watermark soo i put a one way to the source. -Somebody told me that you were doing something extra that you dind´t told us to do that because he said that you were never notyfing the label to change at first it was logic for me but i don´t kind of belive that So if could give some advice i would that you a lot tosker!!
@ToskersCorner
@ToskersCorner 7 жыл бұрын
It's sort of difficult for me to understand your problem because of a language barrier. It sounds like English is not your primary language? Also there may be some mistakes or unexplained things in my videos, so don't always assume you're wrong or I am right because I show something a specific way. Always verify things you learn from multiple sources. There are a lot of opinions and methods out there. This is true not only with my content, but content virtually everywhere. Even MSDN has poor examples and explanations sometimes. If you provide me with code-examples it may make it easier for me to understand what you are asking. You can always use things like hastebin.com for your code and email me your questions (Toskerscorner@outlook.com). It might be easier to help you this way, rather than KZbin comments. Also, in regards to the last question. Make sure you use the UpdateSourceTrigger in the xaml.
@jackkra5847
@jackkra5847 7 жыл бұрын
good tutorial, but i have a question, how much or what code can you have in view.cs, that you still don't break mvvm pattern. can i use set datasource and simple events in view.cs file without breaking mvvm?
@ThisCanNotBTheFuture
@ThisCanNotBTheFuture 7 жыл бұрын
I'm not sure there is a definitive rule. In my experience the view.cs file can (and probably should) contain things like objects that are inherited from a parent view which instantiates the current view, which (if necessary) can then be used to initialize properties in the corresponding view model. Simple events like tooltips could also go in the code behind. And yes, you set the data context (to the corresponding view model) either in the view.cs or in the xaml. Above all else, you want to avoid service calls in the view.cs.
@lucasrodrigues3041
@lucasrodrigues3041 4 жыл бұрын
thanks!!
@shaikhzoyeb
@shaikhzoyeb 6 жыл бұрын
thanks , i understood very easily
@InvitusCode
@InvitusCode 7 жыл бұрын
Amazing Tutorial!! Thank you so much! =)
@ToskersCorner
@ToskersCorner 7 жыл бұрын
RapiersRevenge thanks for commenting! I hope my content continues to be of use, and as always, feel free to email or message me on KZbin for any questions or suggestions. Thanks :)
@risncch6595
@risncch6595 4 жыл бұрын
where is the sound?
@nicklaspersson4687
@nicklaspersson4687 7 жыл бұрын
Good tut. But hard to see with this tiny font size with grey on black. Sunshine in window and somewhat aged eyes.
@ToskersCorner
@ToskersCorner 7 жыл бұрын
Nicklas Persson Thank you for the comment. Unfortunately video editing is just a particular weakness of mine. I do try to improve on it in my future vids, just doing trial and erroratthis point.
@studstud5498
@studstud5498 7 жыл бұрын
yes please. this video has no sound and also I cannot see the code when you explain.
@BenedictoAlvarez
@BenedictoAlvarez 7 жыл бұрын
Toskers can you put the code for this example in github
@BenedictoAlvarez
@BenedictoAlvarez 7 жыл бұрын
please put the code in github
@juanclopgar97
@juanclopgar97 4 жыл бұрын
I love your content and I learned so much but, can you upload new content talking about the Model part?, that would be helpfull
@brandonhacksandtrainers9246
@brandonhacksandtrainers9246 7 жыл бұрын
Hey ToskersCorner thank you for your awesome tutorials ... I didn't understand what is "mode = " can you please explain it to me.. .thanks again ;)
@lancechen4001
@lancechen4001 7 жыл бұрын
its helpful
@karamazov9610
@karamazov9610 4 жыл бұрын
Nice, but the volume is really low.
@BenedictoAlvarez
@BenedictoAlvarez 7 жыл бұрын
excuse ToskersCorner in this line
@ToskersCorner
@ToskersCorner 7 жыл бұрын
Ah, yes you are correct. You caught a syntactical error, good catch! I'll update that soon, thanks for letting me know!
@DJnoratos
@DJnoratos 2 жыл бұрын
Why every time I watch some programming related tutorial, the creator is not capable of making reasonable video volume ???
@studstud5498
@studstud5498 7 жыл бұрын
could you show me with database
@ToskersCorner
@ToskersCorner 7 жыл бұрын
Do you mean property notifications when a database has changed? If you are thinking of something like "push notifications" I haven't myself looked into that with WPF. Otherwise I would think of something like a service layer that just checks the DB at a certain interval.
@redslayer973
@redslayer973 6 жыл бұрын
thanks for this useful tutorial and please fix the link
@ToskersCorner
@ToskersCorner 6 жыл бұрын
Added links in the description for paste files for the code used!
@MikePL101
@MikePL101 8 ай бұрын
The audio is terrible on this video, can't hear what you're saying unfortunately.
@EnotoButerbrodo
@EnotoButerbrodo 3 жыл бұрын
Не работает
@leniedor733
@leniedor733 4 жыл бұрын
LOL at 16:00 start using a non-MVVM pattern? Dont know why you talk about "consistent" when writing code on View part is a non-good practice at all... I really hate using code on view (programmatically) because when you're using a pattern to code just stick to it plz. Now ppl could just copy your example and using at work and that's nasty when others see it. And the other parts are awesome, keep going bro! i just gonna sub for the other
@quantomic1106
@quantomic1106 5 жыл бұрын
Please don't hide your mic under the keyboard.
@DJnoratos
@DJnoratos 2 жыл бұрын
⚠ Do not follow this tutorial code-style. Newer make duplicit variables like he does with the _color, etc. as it is completely redundant... 🙄
C# WPF - Commands [Part 1 Intro + Singular Commands]
17:32
ToskersCorner
Рет қаралды 50 М.
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Commands In WPF
20:34
DotNetSkoool
Рет қаралды 77 М.
Implementing the INotifyPropertyChanged interface
16:07
Eduardo Rosas
Рет қаралды 91 М.
Switching Between Multiple Views in MVVM - EASY WPF (.NET CORE)
12:29
WPF Controls with MVVM: DataGrid
24:59
IAmTimCorey
Рет қаралды 175 М.
WPF C# Professional Modern Flat UI Tutorial
36:44
Payload
Рет қаралды 850 М.
XAML WPF - Styles Part 1, Window Resources
11:53
ToskersCorner
Рет қаралды 39 М.
C# WPF Tutorial - Multiple Views
20:00
ToskersCorner
Рет қаралды 167 М.
C# WPF - Relay/Delegate Commands [Part 2]
21:25
ToskersCorner
Рет қаралды 34 М.
C# WPF UI Tutorials: 01 - The Basics
55:46
AngelSix
Рет қаралды 1 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН