Тёмный

Commands In WPF 

DotNetSkoool
Подписаться 12 тыс.
Просмотров 77 тыс.
50% 1

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.
Find the code here
dotnetskoool.blogspot.com/202...

Опубликовано:

 

1 сен 2016

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 71   
@rahulgoutham7102
@rahulgoutham7102 6 месяцев назад
I feel that it is the best video to learn that explains the Commands in WPF. Thank you very much, Sir 🙏
@iXmerof
@iXmerof 6 лет назад
sometimes you're speaking too quickly, but I like how well organised is your speech here. Thank you for good explanation
@1ThomasTom
@1ThomasTom 3 года назад
Crystal clear! Thumbs up for this short clip.
@davesimon9192
@davesimon9192 6 лет назад
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.
@anulekhachatterjee
@anulekhachatterjee 5 лет назад
Extremely helpful videos. Thank You Sir!
@signon77
@signon77 4 года назад
Thanks for uploading this video. I recreated all your steps in Visual Studio 2019 Community Edition successfully.
@omervts8118
@omervts8118 6 лет назад
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.
@lukeaustin3313
@lukeaustin3313 3 года назад
Great tutorial tbh, the way you explained it made perfect sense. Thanks!
@shobhamahadev118
@shobhamahadev118 5 месяцев назад
A best tutorial on RU-vid on WPF. Please do add videos on concepts like how to implement icons, item templates, scrolling and adding behaviors etc.
@gaugmash
@gaugmash 3 года назад
Very well organised and simple to understand
@shilpav44
@shilpav44 7 лет назад
Awesome Its very helpfull Thank You....
@aslalsujath1341
@aslalsujath1341 6 лет назад
very useful for beginners.Thank you so much.
@asifzaffar343
@asifzaffar343 4 года назад
Helped me alot to understand basic, than you so much.
@spavan1249
@spavan1249 5 лет назад
Very Helpful and theory is really good.
@ginanjarbambang7122
@ginanjarbambang7122 5 лет назад
very thanks.. finally i understand view model...
@mamatovakbar6954
@mamatovakbar6954 3 года назад
Very useful lesson 👍 thank you
@sergeyt4118
@sergeyt4118 4 года назад
This is a good example to illustrate my hesitation while I'm learning C# and .NET in general: I can see the author simplified the example to the best level possible, but I still can not comprehend as a generally logically thinking human beeing - why the hell the authors of this computer language made it so that to implement a simple thing one would reasonably hope to have done in a few lines of code and in just a few property settings hwere needed, it requires tens of lines of code, a number of entities and multi-level representation of the logically same thing (with repetition of entities like onion layers) ?? whose sick mind could invent such a programming philosophy I keep wondering? To me its an ideal source of many mistakes and bugs a general piece of SW is notorious with, or when finally bug-fixed and tested ok than explains why it costs so much to develop software (when another programmer struggles to understand what the author meant to do here and there if not properly commented in the code or without documentation). Doesn't the general science rule (citation from Einstein or someone else?) state that the right thing should be short and clear. To me the code should better be longer in terms of lines but more humanly understandable, to hell with these multiple layers of abstraction:)) Or what is this, a conspiracy? - make it difficult to understand for others and profit from your competitive advantage - artificially created logical constructs? :))
@abdoutech6861
@abdoutech6861 3 года назад
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH thank you, you truly made me laugh from the bottom of my heart XD
@lushlush3927
@lushlush3927 3 года назад
It's not to make things harder. It's used to decouple UI from the business logic. And though for this easy MessageBox.Show he has so much overhead in this example, the overhead is static here. He will be able to reuse that (Relay)Command class (and possibly ViewModelBase class). It's a lot of overhead for a simple and small WPF application, but it's the opposite when the application comes enormous and you want to couple your logic to a different UI. The MVVM design pattern is honestly not that complicated, though i think the documentation of it by many people seems disorganised. Once you understand that INotifyPropertyChanged is simply an event in the Setter methods of properties that helps UI to know when to re-get the value of that property after it has been set to something else and that commands are really just a public delegate void (object) that you pass a function into and can call from your UI using
@mokhtarbelhachi4092
@mokhtarbelhachi4092 4 года назад
Thank you a lot you have the talent of explanation
@raveendrababu6637
@raveendrababu6637 7 лет назад
thank for giving a wonderful video on command
@dotnetskoool5809
@dotnetskoool5809 7 лет назад
Welcome....
@MB-pt8hi
@MB-pt8hi 6 лет назад
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
@ritasrivastava6654
@ritasrivastava6654 3 года назад
Very good tutorial.
@francocrespo6555
@francocrespo6555 3 года назад
Excelente explicación
@abhijitv
@abhijitv 7 лет назад
AWESOME!!!!
@maxron6514
@maxron6514 2 года назад
Outstanding explanation, it can’t get any better than this!
@anveshbabuunnam1658
@anveshbabuunnam1658 5 лет назад
Thank you for explanation, Can you please make video how to hide fields on click of button/Radio button during runtime in MVVM
@kimh.6680
@kimh.6680 4 года назад
I have a generic command that I've been using for years, which looks almost the same as yours. I wonder why Microsoft doesn't deliver this implementation instead of simply providing ICommand without any standard implementation.
@sanjuprajapati068
@sanjuprajapati068 7 лет назад
pls sharesome idea about RoutedCommand and difference between Relay and RoutedCommand..
@viveksaurabh75
@viveksaurabh75 7 лет назад
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
@strigocoruja
@strigocoruja 6 лет назад
Thanks!
@gauravagarwal2460
@gauravagarwal2460 7 лет назад
you did not use the eventhandler "canExecuteChanged" anywhere...
@TT-ud5gf
@TT-ud5gf 6 лет назад
It seems that Command is for Button click use case. Should Slider, ComboBox... use Command to eliminate the code behind?
@prasantabiswal9074
@prasantabiswal9074 2 года назад
excellent explaination of complex in easy way. I want to point out why canexecutemethod return true in both command class and viewmodel class.
@alaatellawi1011
@alaatellawi1011 2 года назад
Thank you very much for your video, I have one question please , till now I can’t understand that, your command has als default Click event , can I build command working with other events? For example hover or any other event? Thank you so much
@anjaliparikh9220
@anjaliparikh9220 5 лет назад
Thanks for the wonderful video, I understood MVVM concept and I did practical as well, my both class files are as like yours still, I am getting the error that my namespace does not find the class. i tried to solve several ways have not got any luck . would you please suggest any solution to cure this problem !!!
@lushlush3927
@lushlush3927 3 года назад
You can set the Datacontext of the window from the UI using If you have your viewmodel in a folder then you could create a new xml namespace: xmlns:nameofchoice="clr-namespace:SolutionName.FolderName"
@PabloHelal
@PabloHelal 4 года назад
Gracias.
@pcanteroh
@pcanteroh 3 года назад
Hello, excellent video; Can you upload similar video in "Visual Basic" language applied in 2 or more windows?
@sashtana5419
@sashtana5419 5 лет назад
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.
@chandranshugautam8070
@chandranshugautam8070 2 года назад
My question is how is it knowing that it has to execute that command on Click only. Why not on hover or anything else. We have not mentioned click anywhere??? Please help.
@chandranshugautam8070
@chandranshugautam8070 2 года назад
Any lead??
@n.renukachowdary6057
@n.renukachowdary6057 5 лет назад
Please provide more examples wpf with mvvm
@abhaykumarsharma5672
@abhaykumarsharma5672 Год назад
Hii Sir, Your videos are great to learn.. But i have one doubt is that, how to copy observable collection to clipboard in WPF Please help
@quantomic1106
@quantomic1106 4 года назад
I have a "ViewModel" does not exist in the namespace "clr-namespace" error.
@euphoric3464
@euphoric3464 2 года назад
Hey i got the same error!!
@sanwalchaudhry2099
@sanwalchaudhry2099 5 лет назад
we have not implemented EventHandler CanExecuteChanged... Why?
@arulkumarmca
@arulkumarmca 5 лет назад
public ClickViewModel() { MyCommand = new OnclickCommand(ExecuteMethod, canExecuteMethod); } This, above parameter value pass error , how to resolve problem
@oussamasethoum2755
@oussamasethoum2755 3 года назад
I faced an error when trying to use it's saying: The name ViewModel does not exist in the clr-namespace:Sample
@oussamasethoum2755
@oussamasethoum2755 3 года назад
I cleaned the solution and rebuild it, it got fixed ^^.
@anushakommu1538
@anushakommu1538 6 лет назад
When writing code in Codebehind page is very simple then why to use these many lines of coding just to call single click event?
@duncanmcdonald5250
@duncanmcdonald5250 6 лет назад
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.
@motivationguru7155
@motivationguru7155 8 месяцев назад
Why we have not use data soure
@hithucheriyan8845
@hithucheriyan8845 6 лет назад
Error occures
@himanshumishra853
@himanshumishra853 6 лет назад
looks like class name you use view model instead of ViewModel
@dharmaraosalana7977
@dharmaraosalana7977 3 года назад
Can you please share the codes as well for the benfit of time
@dotnetskoool5809
@dotnetskoool5809 3 года назад
Yes will share the same..
@dharmaraosalana7977
@dharmaraosalana7977 3 года назад
@@dotnetskoool5809 great thx a lot . Tutorials are really awesome and simple
@dharmaraosalana7977
@dharmaraosalana7977 3 года назад
where can i get the code. Did you get time to upload the code?
@dotnetskoool5809
@dotnetskoool5809 3 года назад
Please check the video discription. Thanks
@dharmaraosalana7977
@dharmaraosalana7977 3 года назад
@@dotnetskoool5809 : you nailed it thx for sharing.It saved lot of time
@mehmetturan8500
@mehmetturan8500 5 лет назад
Thank you for helpful video.? for asking question to you ,can you share your email?
Далее
WPF MVVM Implementation
28:41
Просмотров 92 тыс.
Attached Properties in WPF
18:19
Просмотров 28 тыс.
Me: Don't cross there's cars coming
00:16
Просмотров 13 млн
IEnumerable and IEnumerator Interface in C#
13:58
Просмотров 25 тыс.
Layouts In WPF
24:15
Просмотров 54 тыс.
Dispatcher in WPF
19:12
Просмотров 37 тыс.
IDataErrorInfo Interface in WPF
13:09
Просмотров 23 тыс.
List Vs ObservableCollection in WPF
13:35
Просмотров 45 тыс.
Understanding INotifyPropertyChanged Interface in WPF
12:40
C# WPF - Commands [Part 1 Intro + Singular Commands]
17:32
WPF Commands Explained  [1 of 2 ]
28:14
Просмотров 7 тыс.