HomeОбразованиеRelated VideosMore From: DotNetSkoool

Commands In WPF

198 ratings | 26637 views
Hi Guys , Let us understand what are commands in WPF. WPF commands play a important role to avoid code behind and build apps using MVVM pattern. Let us implement a very simple command. Video is bit long to make you understand but it is worthy time spent to understand commands.
Html code for embedding videos on your blog
Text Comments (23)
s asthana (26 days ago)
Hi, I am new to WPF. Can somebody explain me how actually this code works. Not able to understand how executeMethod of ViewModel is executed.
n.renuka chowdary (1 month ago)
Please provide more examples wpf with mvvm
Sanwal Chaudhry (2 months ago)
we have not implemented EventHandler CanExecuteChanged... Why?
Omer vts (5 months ago)
Thank you for the video. Your video is very helpful but there is two things that i wanted to point out. 1-) You placed the logic on ViewModel, which shouldnt have any logic inside. 2-) By connecting the View model with logic inside to the xml, you have done nothing but pointing code behind(MainForm.cs) to ViewModel.cs. Thank you again for your time and efford.
Aslal Sujath (6 months ago)
very useful for beginners.Thank you so much.
Anusha Kommu (8 months ago)
When writing code in Codebehind page is very simple then why to use these many lines of coding just to call single click event?
Duncan McDonald (6 months ago)
You are right in this simple case it's easier and quicker to write it into the CodeBehind of the View. But we are working towards understanding and using the MVVM pattern which is fundamentally the separation of the Business Logic code and the UI code. Perhaps you should re-watch the "MVVM Pattern in WPF" video again for the explanation of why we want to do this.
Thuyen Tran (9 months ago)
It seems that Command is for Button click use case. Should Slider, ComboBox... use Command to eliminate the code behind?
Dave Simon (1 year ago)
Good video. The only thing about mvvm I don't like is sometimes all of the additional classes and code compared to regular code behind can actually makes your code base more convoluted.
Hithu Cheriyan (1 year ago)
<local:view model x:key"vm"> Error occures
Himanshu Mishra (8 months ago)
looks like class name you use view model instead of ViewModel
Strigo Coruja (1 year ago)
Thanks!
MB (1 year ago)
I don't understand your example with print command. Why should we write the code with codebehind page three times. I don't think anyone is doing it. You just write once a print function and just call it three times in the events in the code behind page. By using commands you also have to call the command three times, just not in the code behind page but in the binding of the view. Correct me if you have another opinion
Xmerof (1 year ago)
sometimes you're speaking too quickly, but I like how well organised is your speech here. Thank you for good explanation
kishor kotule (1 year ago)
Awesome, Superb Videos not seen any simple explanation like this before....keep it up buddy. Just a quick question " will this logic change if I'm using Prism or MVVM light or any other Libraries? " I am new to WPF and got confused here.... my sole purpose is to use Prism 6 Library for my project. Thanks.
Pawan kumar (1 year ago)
No it won't
Shilpa V (1 year ago)
Awesome Its very helpfull Thank You....
vivek saurabh (1 year ago)
HI good one...Can we get the vieo related to difference between ICommand and Routed Events ...and when to implement it..Please make a video for this
Abhijit Vyas (1 year ago)
AWESOME!!!!
Raveendra Babu (1 year ago)
thank for giving a wonderful video on command
DotNetSkoool (1 year ago)
Welcome....
Gaurav Agarwal (2 years ago)
you did not use the eventhandler "canExecuteChanged" anywhere...
Sanju Prajapati (2 years ago)
pls sharesome idea about RoutedCommand and difference between Relay and RoutedCommand..

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.