Intro to WPF: Learn the basics and best practices of WPF for C#
HTML-код
- Опубликовано: 6 июн 2024
- Newsletter signup (with exclusive discounts): signup.iamtimcorey.com/ (your email will be kept safe and you will not be spammed).
Facebook Page: / iamtimcorey
Want to see a full C# application built from scratch?
Check out this course: www.iamtimcorey.com/p/c-appli...
Need to know SQL Better? Check out this course: www.iamtimcorey.com/p/sql-dat...
In this video, I will introduce you to WPF, show you the basics of how to get things done, and discuss the benefits and pitfalls of using WPF compared to WinForms. In the end you should be comfortable getting started with WPF.
0:00 - Intro
0:52 - Creating WPF app
3:35 - Differences between WPF and WinForms
7:02 - WPF template overview
8:51 - WPF Design system
12:09 - WPF Grid
23:25 - VS designer layout
26:24 - Adding a label: TextBlock
30:25 - TextBlock properties
34:04 - Style hierarchy
35:15 - Global font for application
40:59 - TextBlock and TexBlox
47:03 - Element spacing
53:07 - Button
58:20 - Adding an Event to a button
1:03:42 - Disable UI Debugging tools
1:05:34 - Summary and concluding remarks
Thanks to Ralfs HBK for the chapter breakdown
I sorted this comment section by 'Newest' out of curiosity, and to my surprise you're still responding to new comments you're getting. That's amazing dude! What a helpful guy.
I do try.
You are an amazing teacher. You explain the concepts with incredible clarity. Excellent content!
Thanks!
I disagree.
@@DupczacyBawol Why? Who's a WAY better teacher?
@@IAmTimCorey yes you are .
IAmTimCorey I'm not sure whether "tagging" the owner of a reply to a comment works but I'm trying anyways because I'd really like to get your opinion on something and don't know how to get in contact with you.
But firstly, I'd just like to thank you for the amazing content you provide. When it comes to C#, Visual Studio, and dot NET I think you are unmatched in this field on RUclips. You explain topics with clarity and the right mix of depth and simplicity. Thank you for all the time and effort you put into sharing your knowledge with us all.
Now....
I have a few Windows applications that I wrote using both VB.NET/WinForms and also VB/ASP.NET/WebForms/Mysql years ago and I'm interested in rewriting them using C# so that there is a better chance that there will be somebody who can maintain them in the future if I'm no longer employed by the company that I wrote them for. We are not a software company and there is only a very small handful of people who can read and write code. Seeing how Microsoft has pretty much given up on developing Visual Basic any further and all their eggs have pretty much been placed into the .NET 5 with C# basket I'm thinking that there will be a far greater chance of finding somebody who is familiar with C# rather than VB.NET.
What I'd like to know however, is what GUI should I focus on in late 2020 for the desktop apps?
Is UWP dead?
Should I go with WPF?ł
What is the deal with WinUI 3?
Should I be using Core or Framework for desktop development??
When will we have the one platform to rule them all, dot net 5, and should I hold out until this has officially released and focus my efforts there?
I've watched a ton of videos on XAML and various programming languages and it is very rare that anyone will go into detail on what they are doing. Most people will just program something real quick and you are just along for the ride leaving you feeling lost at the end. They don't explain everything they write like you do. I don't have that lost feeling when I watch your videos. Very well done!
I am glad it was so helpful.
@@IAmTimCorey Like choosing a font family in a dropdown list box for 20+ goddamn seconds. Why not start with MS Word explaining what fonts are? Skip-skip-skip... ugh! Next!
Just want to say thank you for all the content. I've watched so much IAmTimCorey over the last few weeks that I feel like I know you. Even the stuff that covers topics that I already understand has been time well spent. It's all full of seasoned developer nuggets.
You are most welcome. Thanks for watching.
I am currently making an application in WPF, it's my first project in WPF. Funny that this video came along right when I needed it.
Awesome!
it's more like freighting
Fantastic tutorial! I've done a couple of projects in WPF before by self teaching myself but this is amazing information that I really haven't seen anywhere else! You also explain and clarify everything in a way that anyone can watch. Thank you for making this video!
I appreciate the kind words.
This is perfect! I've _just_ been looking for sources for digging into WPF, and was looking for tutorials from you - like literally just a few hours ago!
It's like you read my mind, and decided "Yeah, here you go" :-)
Thanks,
Jakob
That's great! Glad I was able to provide the content when you needed it. This content has been a long time coming. I'm glad to finally get it out the door. There will be more WPF content in the near future. I'm even considering doing an add-on to my C# application course where I replace the WinForms UI with a WPF UI.
That would be great! I'm just about through (just completed lesson 24), and porting the app to WPF would simply suit my needs perfectly.
I was also looking for a WPF Tutorial few days ago. And now, there's one from Tim. I was so happy seing that on my Start-Page.
Yes! Please, that would be a perfect way to really grasp the difference in capabilities
IAmTimCorey - that would be great, as I stopped the winforms application course because of so many saying it's not relevant anymore. It seems that Microsoft is caught up on HTML5 now, and has pretty much dropped any future with winforms and wpf
Thank you so much for this tutorial. This is going to sound goofy, but I had it in my 'sleep learning' playlist and I was able to grasp data binding the next day after being confused about it for MONTHS. Your other C# videos have been wonderful, too. Some of the best free learning content I've ever heard is on this channel.
Glad it was helpful!
This video was coming at the right time. Thanks Tim for such a great basic tutorial. I'm looking forward to see more of these tuts.
Glad it helped you out. More will definitely be coming.
Great video Tim. I wish more tutors took this kind of pace to explain concepts.
Thanks, I appreciate it.
Wow! I'm so glad I found your channel. You cover everything I need and more! Keep up the great work Tim.
Thank you!
This is the second video by you that I am watching and I am amazed by the effort you take to keep things simple and understandable. I subscribed immediately after watching your first video - Desktop UI Showdown and it kind of led me to this one. Thank you.
I learned more from this single video than a semester in college. Thank you so much!!!!!!
Awesome!
3rd year in college and none of my lecturers have ever said "don't use drag and drop" xD
@John S Yeah real village idiots watch only Tim's videos xD
If that was ass-kissing colleague you must be dean there already xD
You're a good instructor.
I've not had people actually __pausing__ like you to do let information settle in, its calming, and an important part of being a teacher. To used to having a million concepts thrown at me at once, thanks for giving those things the moment of silence to let your students process them.
I am glad you enjoy how I teach.
This is a great tutorial! You get straight to the point and explain things as simply as possible, making everything so easy to understand.
Keep up the good work!
Thank you!
I'm glad I picked your video here to get a proper overview of what I was looking for.
Even though I knew many things already, I never felt the urge to skip parts which I usually always do in that case.
The amount of information and the pace were just perfect to easily follow what's going on without getting monotonous or repetitive.
Now I'm just happy seeing all those other videos on your channel waiting to be watched.
Great to hear!
every second is precious for me. wonderful - not only this video but your whole channel
Awesome!
Hello, Tim!
Greetings from Russia :)
Thank you very much for your work, i found all the C# video really useful.
This is my first expierence in WPF, and due to you XAML seems quite simple and friendly.
Guess, that's not my last WPF application)
Glad to know this encouraged you to check out WPF. I hope you have a great experience with it. There are some really great features in it.
You are a blessing! I have followed paid courses, and no one explains c# applications as well as you do. Thank you so much!
You're very welcome!
this is far away from the videos I've watched for starting WPF. this is the best one it's amazing and thank you for sharing such a wonderful content
You are welcome.
Thank you for this tutorial. I really enjoyed it and it helped me tremendously. At first it was all confusing until I watched your video and now I understand how to properly make a wpf form. Cheers!
Excellent!
Hey Tim, great video and yes we want more WPF tutorials.
Good to know Thomas. Thanks for the feedback.
First time to watch Tim Corey. Very impressed. He has a talent for making things look easy. Highly recommended.
Thank you!
I love the fact that you left the bug error into the final video. That really depicts the day to day life of a dev. Keeping it real. Thank you sir!
You are welcome.
0:00 - Intro
0:52 - Creating WPF app
3:35 - Differences between WPF and WinForms
7:02 - WPF template overview
8:51 - WPF Design system
12:09 - WPF Grid
23:25 - VS designer layout
26:24 - Adding a label: TextBlock
30:25 - TextBlock properties
34:04 - Style hierarchy
35:15 - Global font for application
40:59 - TextBlock and TexBlox
47:03 - Element spacing
53:07 - Button
58:20 - Adding an Event to a button
1:03:42 - Disable UI Debugging tools
1:05:34 - Summary and concluding remarks
Thanks again
There is now a pop out XAML function which allows you to have your XAML on one screen and your window on another in case anyone is curious
Yep, that's a great new feature.
I've always said it's important to know things, but it's even more important to know what you don't know. Telling someone this is how you do it only presents half the picture, telling them why you don't do something is the other more important part. Most people learn this the hard way, I appreciate the time you take to fully explain the topics
Thank you!
Really good video, your style of explanation is just the right pace and this has given me a better handle on WPF than many other videos
Excellent!
Thank you for the good lesson. You're an awesome teacher. Can you make a similar video for WPF C# Material Design or some other library that gives us the power to make our UI look better?
I will add it to the list. Thanks for the suggestion.
The first time I saw the XAML associated with a WPF app, I freaked out and returned to WinForms. After watching your tutorial, I understand more about XAML and how to write it and it isn't as scary now. Thanks.
Excellent!
Hi Tim, thank you so much for the awesome tutorial! I am really looking forward for more WPF tutorial!!!!
You are welcome. Glad you enjoyed it.
Hello, Tim,
Just to tell you that even 3 years later, the tuto is still as current as ever. Thanks a lot :)
Great! You are welcome.
Great explanation, even though I recomment setting the speed to 1.1 or 1.15x :)
Thank you!
Bob Ross of Programming! ;)
I appreciate the kind words. That is high praise.
What a great video this is! Thank you so much for taking the time to do this.
You are most welcome. Thanks for watching.
Great! For a new project we are just changing from old winforms to "new" WPF - Your tutorial comes at exactly the right time. I am particularly interested in the correct implementation of the MVVM pattern.
Thank you very much for your work!
I'm sensing a theme here. You are the fourth person so far today to mention that this video came at the right time. As for MVVM, that's definitely on the list of things to cover. As I mentioned in the video, I love Caliburn.Micro. It makes MVVM in WPF easier (once you understand it).
Sir, you explained very clearly. Your video was posted on 2017, is there any changes in WPF with 2022? it would be good if you updated this course with the last version of WPF if it is available. thank you so much for your work.
I watched this at 1.75 speed and still felt like you're going slow. I can't understand you at 2x unfortunately. I think it's just a bit wordy.
Well, there is a lot to cover. My focus is on covering the context of a topic so you know how to put it into a real-world scenario and succeed. That means it will always be a bit wordy.
Sometimes I can't handle when people are very wordy when it's a topic I'm familiar with, too. This is the best beginner WPF video I've seen so far on YT though so it's worth it for me.
Do better
Just in time for an excellent tutorial! Thanks, Tim!
Great! Glad you enjoyed it.
You are the best teacher i ever seen on yt, u dont do that fast, u do that soo slowly and that is amazing.
I am glad you found my content valuable.
wow, this is great! still works the same in Visual Studio 2019, and I absolutely love your tutorials! The way you explain it makes learning it fun and easy. Thank you, and keep up the awesome work!
You are welcome.
After almost 18 month learning C# and win forms I kind of finished creating an entire application with more than 100 tables, more than 500 stored procedures, and lots of functionalities, it is time to move on and start with WPF. Thank you for all your great videos Tim.
Excellent!
I'm really amazed that you answering all comments. Nice to see that commitment and passion for the job. I used WinForms for several years for my little projects, usually apps for Arduino stuff and STM32 controlling via serial ports. I attempted to learn WPF 3 years ago but gave up because I saw that it really requires time to grasp all and learn and I didn't have time that much. Now, as years passed, I have more time to learn new stuff and I think this time it's gonna be successful with your great lectures. I see that this platform can create really fancy stuff in UI.
Great! I’m glad my content is helpful to you.
You really are an amazing teacher. Good mic, good explanations, very good reasoning to give extra info.
Thank you.
Hey mister Corey, I don't know if you remember me from some of your other videos but I recently switched jobs and was plunged into a WPF application. I'm watching this on a Saturday so I can have a bit of an idea on how it all works. You made WPF a lot simpler and gave me the confidence I need to work in this new team. Thank you!
I am glad it was so helpful.
Such an amazing tutor. Love you VS and SQL Server tutorials. Thank you !
You are most welcome. Thanks for watching.
Is this Data Access tutorial
Couldn't find content so clear! I switched from winforms and it was so confusing you made a whole lot easier!!
Glad it helped!
I know this is old. But that soothing voice and the way you explain is awesome.
Thanks!
This is a great video. I was feeling kind of confused about using WPF to design a UI, and this video has clarified a lot of things for me. Looking forward to watching your other videos! Thanks for uploading!
Awesome! I'm glad it was so helpful.
This tutorial makes it easy to grasp the idea of WPF easily. thank you.
You are welcome.
Hi Tim, I have not used WPF for 7 years. Your intro is a great tutorial for restarting. By the end of this week, I will complete a WPF based machine monitor that I started today, and thanks so much for your help !!!
Nice! I'm glad this video could jumpstart your development.
Fantastic one-stop refresher video. Thank you for putting this together.
You are most welcome. Thanks for watching.
This is the most well explained, clearest and helpful tutorial I have ever watched
Glad to hear it
Hi Tim, thank you for the video !
You give so much informations and contexts, it's really really nice to understand what you're showing and not just copy-paste !!
Have a good day and thank you again !
Glad it was helpful!
Excellent video. Great pace and great job! I'm a beginner with C# and I'll be looking at some of your other videos. It's tough to find really good training videos, I've paid for multiple sites and this is as good as they get!
Thank you!
Thank you! I was struggling in these, but now done! a new sub!
and there are lesser tutorials but this one is absolutely great.
You are welcome.
Did some courses on the subject on pluralsight, but they did not explain things well at all.. yeah, they say what to do and so on, but they don't explain WHY or just in general explain how things work.
Your way of explaining the mechanisms behind everything is so important, and understanding why things work like they do is so much better of a foundation, so THANK YOU, Tim Corey!
Thanks for watching and trusting Tim to help expand your skills
I was always interested in building windows applications but never knew where to start from and how to do it . Recently discovered about WPF and wanted to find a video tutorial on various concepts of WPF and XAML because reading this much code attached with a simple example for a new college student like me is extremely tedious . I searched for WPF tutorial and your video was recommended and I am extremely grateful to you for making such videos . It was extremely helpful and much easier to understand . Thank you so much .
Glad its helpful. Please share with your classmates. Our community is about lifting each other up to make all better developers.
I didn’t think it was possible to not hard code margins, but I was surprised when I was able to use all different controls to space out things and attach them to grids, this tutorial makes everything easy to hop in and get going
Great! I am glad it was so helpful.
Best C# tutorials anywhere. Thank you
You are welcome.
Hey Tim, great video and yes expecting more such cool WPF tutorials.Thanks
More such coolness is on the schedule.
this is just what I was lookin for thank you very much
I am glad this was so helpful.
Brilliant video! Did lots of Caliburn Micro and WPF on my summer internship in 2019. I am now creating a chatbot to use on Twitch (gaming live-stream platform) and found a library that covers 100% of the Twitch API. Safe to say I have forgotten 80% of the code. Your videos helped me to remember the code and understand why I wrote it this way much better (I am speaking for this video and the Caliburn Micro video). You are doing a brilliant job, keep up the great content!
Awesome! I'm glad it was helpful.
Thank you so much for being clear, concise, and actually informative. Too many coding tutorials are just experts talking while they build something and don't really explain the how and why. They also go at a pace beginners can barely keep up with but your pacing is perfect! you have earned a sub.
Glad you liked it!
I sort of learnt WPF a year or so ago but I didn't learn it properly and I didn't really know what was going on half of the time. So I came here in the hope of learning it properly this time. Thanks for the tutorials :)
You are welcome.
I just watched the whole video! your explanation is simple and clear. Thanks a lot. Now I need to practice...
Excellent! I am glad you enjoyed it.
Great introductory tutorial. Thanks.
Having worked with WinForms before, jumping into WPF seemed overly complicated.
Dragging and dropping seemed so intuitive and XAML seemed like a step backwards.
But XAML is so much more powerful than WinForms.
Thanks again.
Yep, you got it. It is more complicated but it is more powerful.
if you were my teacher at school i wouldn't want to leave the school.
That's how good your tutorials are man , i just want to say that i appreciate your work and i know you probably super busy with your projects but i wanted to say thank you and keep going , doing what you doibg ;)
I appreciate the kind words.
Grt explanation, i understood the concepts and explained at the time of my Interview..It worked for me Thanks Tim.
Excellent! I am glad it helped.
This guy is a wholesome finding. I recently started coding in C#. I am only 16, but despite this fact and also that I'm Russian his english is super fluent so I never miss a word. Great job out there! Planning to make VK (russian social network) client
I am glad it is clear and understandable.
That's an awesome video. I'm curently learnig WPF and until now in the learnig material it is realy a lot like WinForms style with WPF.
I'm looking forward to further WPF content.
Glad you enjoyed it. I'll have more WPF content out soon.
This tutorial has convinced me too try something outside of winforms. Really liked it thank you
Glad I could help!
Thank you Tim . I really learned a lot with your tutorials. Your videos are perfectly structured and your explanations are easy to understand. Better than every paid Tutorial! =)
Thanks for investing your time with Tim and trusting him for your skill development
As always great video, Tim !
Thank you!
This video has been very helpful! thank you for making it!
You are most welcome. Thanks for watching.
Great stuff Tim. Thank you so much :-)
You are welcome.
Just wanted to say thanks for making this. Better than the official Windows tutorials!
You're welcome!
Great video for Beginners. All the basic controls in VS for WPF were also explained. Keep going with your efforts
Thank you, I am glad you found it helpful.
There are lot of programmers possessed with great skill in programming but dont have a heart to share those skills for many reason, thank you Tim for sharing and also my boyfriend that recommended me to watch this video. 🥰
Thank you for the kind words!
Thank you, you made me regain motivation in learning c#
Glad to hear that!
Loved this explination! I especially like when you stop yourself to address things that may seem like contradictions, great teaching.
Glad it was helpful!
thank you very much. This video was very helpful!!
i'll pass an old WinForm project to WPF to see the difference and show you the result :)
Excellent!
This is perfect... really wanna master development with wpf...Thanks
Great! Glad it is useful to you.
thought I was not able to learn this. now I did it! thanks Tim!
Awesome!
Thank you so much, you're a great teacher, the concepts are really easy to understand and detailed tutorial as well.
You're very welcome!
Tim's wishlist number 1 and 2 are fulfilled in VS2022 ✨✨
Yep.
Thanks for the great explanations of not only what but, much more importantly, why.
You are welcome.
Wow I didn't realise I was doing it completely wrong this whole time. Your videos are really good at explaining concepts
I'm glad this cleared things up for you.
Thank you Tim, now I will go to your next video on WPF with MVVM pattern
Great!
Thanks Tim -this tutorial is very well done!
Thank you.
I have to say your tone, and speed are EXACTLY what I need when learning. It's not too fast, not too slow and VERY inFORMative (hehe) So thank you, and please don't change this human feel. Every other instructional video I have tried so far assumes you are a Master already even though it says "Beginner" or the dude will rattle off the steps like a crackhead that just won the lottery.
Glad to help!
Great tutorial.. thanks for the info on the Caliburn.Micro Framework add-on too. Valuable info.
I'm happy to help.
That was a great introduction. I'm going to try it!
Great!
Very helpful! Very clearly explained and great knowledge. Great work!
Thank you.
Thanks for this tutorial Tim! with the recent announcement of .net 2.0 standard and xamarin forms, mastering XAML will definitely help!
You are welcome. Enjoy.
Excellent introduction. Very well done with a very good didactic flow.
I'm glad you enjoyed it.
Im not native english speaking person but this video is so well structured that its easy even for me to get a hang of things you are talking about, thx man helped a lot
Excellent!
Thank you! Your videos are perfect!
I am glad you think so.
Perfect tutorial. Thank you!
You are welcome.
Good job , and yes we want more WPF tutorials.
Good to know. Thanks.