Implementing INotifyDataErrorInfo (View Model Data Validation) - EASY WPF (.NET CORE)

  Рет қаралды 20,042

SingletonSean

SingletonSean

Күн бұрын

Пікірлер: 35
@RamonWilliams
@RamonWilliams 4 жыл бұрын
I can't quite express how big of a help these videos are Sean. You have a great way of explaining things. Thank you very much!!!
@longuinni
@longuinni 4 жыл бұрын
Awesome tutorial!!! Finally one tutorial that explains the right way. Thanks Sean. Another suggestion is how to animate controls with storyboard.
@SingletonSean
@SingletonSean 4 жыл бұрын
Thanks Fernando! Happy to hear this satisfied your INotifyDataErrorInfo request from earlier. I've touched on storyboard animations a bit in my Custom Controls playlist, but it would certainly be useful to dedicate a video to the topic. Great suggestion.
@robbienorton9522
@robbienorton9522 2 жыл бұрын
Another Great WPF Tutotrial. This one I didn't have trouble follow your speed or have to slow the tutorial down. I do have to say it seems kind of a hokey way to not use inheritance or a viewmodelbase with error handling built in, but that's just me. Keep up the excellent work !! =)
@bullet4255
@bullet4255 2 жыл бұрын
Concise and helpful, great job!
@islamabdel-fatah5210
@islamabdel-fatah5210 2 жыл бұрын
Excellent work , thank you very much !
@dhruvsinha3907
@dhruvsinha3907 3 жыл бұрын
Awesome tutorial !! Thank you
@andrijs1521
@andrijs1521 3 ай бұрын
i think this code from 8:00 is not in the repo
@amryakout2957
@amryakout2957 2 жыл бұрын
Great work 👏
@andreac1293
@andreac1293 2 жыл бұрын
Thank you. Very useful tutorial. Just a question: How can I show only the first element of the errorContent in the adorner? On google I found this Text="{Binding [0].ErrorContent}" but it seems not working.
@hariprasadc8332
@hariprasadc8332 Жыл бұрын
I also want a placeholder in the textbox, so if I use stackpanel for the template its not working. And If I use Grid the error msg is comming inside the textbox. Is there any way to solve this issue?
@X3.notcom
@X3.notcom Жыл бұрын
Hi! Great tutorial! Wery helpful, but I can`t find unsubcribe "_errorsViewModel.ErrorsChanged -= ErrorsViewModel_ErrorsChanged;" in video
@hariprasadc8332
@hariprasadc8332 Жыл бұрын
Hi I am using INotifyDataErrorInfo in a user control and it validates if a textbox is null or empty. I have created an event in a interface invoked that event when there is any validation errors. I subscribed this event in another project by loading the dll of the above usercontrol and tried to subscribe to the event. But the event was not getting triggered in this project. I want to display the number of errors in the usercontrol and show the number of errors when the user clicks on next button.
@mattc4153
@mattc4153 2 жыл бұрын
Nice work you know WPF well. Any chance you would be available for hire for a few hours for some Q&A? Thanks!
@hishoegypt1980
@hishoegypt1980 Жыл бұрын
Hi, i've a problem>>> _propertyErrors does not have GetValueOrDefault method, what should i do?
@MagoMakes
@MagoMakes 9 ай бұрын
Same here - not sure how this guy magic'd a method in Dictionary!
@RustyAngelArm
@RustyAngelArm 4 жыл бұрын
Thank you. The information about ErrorTamplate is very helpful to me. When I was choosing ways to implement INotifyDataErrorInfo, I ended up using Fody Validar + FluentValidation. And even if you don't want to use Fody, you can still use their INotifyDataErrorInfo example implementation: github.com/Fody/Validar#fluentvalidation Call it in the constructor like _validationTemplate = new ValidationTemplate(this);
@alejorostata3899
@alejorostata3899 2 жыл бұрын
How would you trigger this, say on ICommand?
@clickdraw9762
@clickdraw9762 2 жыл бұрын
The xaml part doesn't work form me in a .NET Framework 4.7.2 Application :(
@jadenschulz1004
@jadenschulz1004 Жыл бұрын
Data validation in wpf feels bad... so many edge cases, I can't figure out a truly mvvm way to do it. In your example here you can type letters into the field and still submit
@alanv.174
@alanv.174 3 жыл бұрын
Really great video and explanation, I just have one problem with it. If the user were to skip a mandatory field entirely there would be no error as the setter of the field wouldn't be called. Do you have a clean solution for this?
@SingletonSean
@SingletonSean 3 жыл бұрын
Thanks Alan! Ironically, I've been doing a lot with forms lately. My approach has been to re-evaluate all of the validation when the user clicks the submit button. Here's a live example (not written by me): eo6en.csb.app/
@alanv.174
@alanv.174 3 жыл бұрын
@@SingletonSean Thank you! I'll be sure to check out the example. I ended up putting the validation in a method which also gets called when you press the button as temp solution. Cheers for all the informative content. Keep it up !
@altair91100
@altair91100 2 жыл бұрын
where's the method OnPropertyChanged?
@2005bgva
@2005bgva 2 жыл бұрын
Hi SingletonSean, thanks for this video, please, please could you activate subtitles?
@IT7kaya
@IT7kaya 3 жыл бұрын
Not able to use GetValueOrDefault() for Dictionary
@BaNaNaJoE185
@BaNaNaJoE185 2 жыл бұрын
You are probably using a different target framework... Try this: public IEnumerable GetErrors(string propertyName) { return _propertyErrors.ContainsKey(propertyName) ? _propertyErrors[propertyName] : null; }
@siavash2176
@siavash2176 4 жыл бұрын
I wish there was a quick way without doing all this repetitive code on all projects, I hope with C# source generator this stuff get better, same for PropertyChanged, you have to have fields for each property and raise the property changed event, I use Prism and it makes it much easier but if there was a way to do it with an attribute it would be much better, anyway the video was great and very helpful like always, thanks!
@SingletonSean
@SingletonSean 4 жыл бұрын
I agree Siavash. It is definitely repetitive to scaffold out all of these interface implementations, such as INotifyPropertyChanged and INotifyDataErrorInfo. Luckily those libraries ease the pain a bit, haha.
@r.o.9322
@r.o.9322 4 жыл бұрын
Very nice! But one thing I would have to say. Try to explain a bit more what you have to explain, not just go over some really important things like everybody already know them :) Thank u!
@SingletonSean
@SingletonSean 4 жыл бұрын
Thanks R.O! I see what you mean. I try my best to stay on topic for my videos, so I do leave out some of the basic concepts. This helps the videos stay short and concise, and also helps people find exactly what they're looking for (sometimes). I would be frustrated if I was searching "cat" in the dictionary, but the definition of "cat" was nested in the middle of a paragraph about how to sing the ABCs (I hope that's a good analogy...). I will admit it does put people who are newer to WPF at a disadvantage, which is a shame because my content should help everyone grow. To balance this, I plan to put out more fundamental videos in the future, and then link to those videos whenever I explain something that might require additional knowledge. Thanks for the feedback R.O!
@r.o.9322
@r.o.9322 4 жыл бұрын
That sounds good!
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
7 C# Tips and Tricks to impress your .NET Developer friends
7:48
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 324 М.
Algebra 2 Introduction, Basic Review, Factoring, Slope, Absolute Value, Linear, Quadratic Equations
3:59:44
WPF INotifyPropertyChanged and Databinding
14:30
Payload
Рет қаралды 42 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 82 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 43 М.
Handling WPF Routed Events with MVVM Commands - EASY WPF (.NET Core)
10:54
Is LEARNING WPF still WORTH it in 2023?
10:59
tutorialsEU
Рет қаралды 64 М.
Intro to the Zig Programming Language • Andrew Kelley • GOTO 2022
50:14
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН