TOC

This article is currently in the process of being translated into Hebrew (~27% done).

Data binding:

Introduction to WPF data binding

וויקיפדיה מתארת יפה את מושג קשירת המידע:

קשירת מידע היא טכניקה כללית הקושרת יחדיו שני מקורות למידע או אינפורמציה ושומרת על סינכרון של המידע.

עם WPF, מייקרוסופט שמה את קשירת המידע במושב הקדמי וכשמתחילים ללמוד WPF, מגלים שזה חלק חשוב של, למעשה, כל מה שעושים. אם מגיעים מהעולם של WinForms, ההתמקדות הגדולה בקשירת מידע עלולה להפחיד מעט, אבל כשמתרגלים לכך, סביר להניח שמתחילים לאהוב אותה, משום שהיא גורמת לדברים רבים להיות נקיים יותר וקלים יותר לתחזוקה.

Data binding in WPF is the preferred way to bring data from your code to the UI layer. Sure, you can set properties on a control manually or you can populate a ListBox by adding items to it from a loop, but the cleanest and purest WPF way is to add a binding between the source and the destination UI element.

Summary

In the next chapter, we'll look into a simple example where data binding is used and after that, we'll talk some more about all the possibilities. The concept of data binding is included pretty early in this tutorial, because it's such an integral part of using WPF, which you will see once you explore the rest of the chapters, where it's used almost all of the time.

However, the more theoretical part of data binding might be too heavy if you just want to get started building a simple WPF application. In that case I suggest that you have a look at the "Hello, bound world!" article to get a glimpse of how data binding works, and then save the rest of the data binding articles for later, when you're ready to get some more theory.


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!