STOP Modifying WPF Controls Directly! - View Model Refactoring For MVVM
July 15, 2024
• 839 views
wpfwinuimvvmwpf mvvmwpf uixamlwpf corewpf data bindingdata bindingdotnetwpf .net corewpf data binding c#wpf controlswpf ui designwpf netwpf xamlvisual studioclean codesoftware engineeringC#mvvm wpfbindingcoding.netsplash screenasync awaitview modelmodel view viewmodelmodel view view modelxaml data bindingdesign patternsdata binding c#refactorrefactoringfront endC# wpfwpf tutorialwpf design tutorial
Rule number 1 about WPF club: We don't talk about WPF club.
Wait! That's not right -- Rule number 1 is about directly manipulating our views!
In WPF, the predominant way of designing user interfaces is leveraging MVVM. We use binding to get our controls (the views) hooked up to the state of the view models.
Through data-binding, when our view models update, the views are triggered to get updates for the new state! This works the other way too, of course.
In this video tutorial, we'll refactor a splash screen with a progress bar to support a view model. We'll avoid updating the controls on the view directly and leverage data-binding!
