- Mastering Windows Presentation Foundation
- Sheridan Yuen
- 202字
- 2021-06-24 16:49:02
Data binding
One often overlooked aspect of the MVVM pattern is its requirement for data binding. We could not have the full Separation of Concerns without it, as there would be no easy way of communicating between the Views and View Models. The XAML markup, data binding classes, and ICommand and INotifyPropertyChanged interfaces are the main tools in WPF that provide this functionality.
The ICommand interface is how commanding is implemented in the .NET Framework. It provides behavior that implements and even extends the ever useful Command pattern, in which an object encapsulates everything needed to perform an action. Most of the UI controls in WPF have Command properties that we can use to connect them to the functionality that the commands provide.
The INotifyPropertyChanged interface is used to notify binding clients that property values have been changed. For example, if we had a User object and it had a Name property, then our User class would be responsible for raising the PropertyChanged event of the INotifyPropertyChanged interface, specifying the name of the property each time its value was changed. We'll look much deeper into all of this later, but now let's see how the arrangement of these components help us.
- C語言程序設(shè)計(jì)(第2版)
- C#程序設(shè)計(jì)教程
- Groovy for Domain:specific Languages(Second Edition)
- Learning Python Design Patterns(Second Edition)
- 微信公眾平臺開發(fā):從零基礎(chǔ)到ThinkPHP5高性能框架實(shí)踐
- 信息技術(shù)應(yīng)用基礎(chǔ)
- Python機(jī)器學(xué)習(xí)算法: 原理、實(shí)現(xiàn)與案例
- C專家編程
- 零基礎(chǔ)學(xué)C語言第2版
- Scala編程(第5版)
- OpenCV 3 Blueprints
- Hands-On Dependency Injection in Go
- Tableau Dashboard Cookbook
- 深入理解MySQL主從原理
- Isomorphic JavaScript Web Development