Edit

Share via


Data binding in Windows apps

Data binding connects your app's user interface to its data, creating a dynamic relationship that keeps your UI current and responsive. When you implement data binding in Windows apps, you establish a clear separation between your app's data layer and presentation layer, which improves code organization and makes your app easier to maintain and test.

Windows apps support two primary data binding approaches: the {x:Bind} markup extension and the {Binding} markup extension. You can use either approach individually or combine them within the same app. The {x:Bind} extension, available in Windows App SDK and UWP apps on Windows 10 and later, offers better performance and compile-time validation.

Whether you're displaying a single data item, binding to collections, or implementing complex architectural patterns like Model-View-ViewModel (MVVM), data binding provides the foundation for creating responsive, maintainable Windows applications.

Topic Description
Data binding overview This topic shows you how to bind a control (or other UI element) to a single item or bind an items control to a collection of items in a Windows App SDK app. In addition, we show how to control the rendering of items, implement a details view based on a selection, and convert data for display. For more detailed info, see Data binding in depth.
Data binding in depth This topic describes data binding features in detail.
Bind hierarchical data and create a master/details view You can make a multi-level master/details (also known as list-details) view of hierarchical data by binding items controls to CollectionViewSource instances that are bound together in a chain.
Data binding and MVVM This topic describes the Model-View-ViewModel (MVVM) UI architectural design pattern. Data binding is at the core of MVVM, and enables loose coupling between UI and non-UI code.
How to data bind with the MVVM Toolkit in WinUI apps This tutorial builds on the Create a WinUI app tutorial and shows you how to implement data binding with the MVVM Toolkit. It covers updating your view models to leverage the MVVM Toolkit and the differences between the MVVM Toolkit and traditional MVVM approaches.
Functions in x:Bind In Windows App SDK apps, {x:Bind} supports using a function as the leaf step of the binding path. In this topic, learn how properties are bound to functions to do conversions, date formatting, text formatting, text concatenations, etc.