Binding with x:Bind
Binding is, without any doubt, the most powerful feature of XAML. Thanks to binding, you can easily connect the UI with data, keeping the two layers separated. As we're going to see in Chapter 6, Building a Future-Proof Architecture, binding is at the core of the Model-View-ViewModel (MVVM) pattern, which is the most productive technique to build applications that are easy to test, maintain, and evolve.
Traditional binding in WPF, however, has a few limitations, caused by the fact that it's always evaluated at runtime. This approach introduces challenges such as the following:
- Performance issues.
- You cannot catch binding errors until an application is running.
- If you want to change the way data is displayed in a UI, you must rely on a converter, which introduces additional overhead.
With the goal of tackling these problems, Microsoft has introduced in WinUI a new markup expression called x:Bind
. It works in a similar way to traditional...