Questions tagged [data-binding]

A general technique that binds two data/information sources together and maintains them in sync.

Data binding is a general technique that binds two data/information sources together and maintains them in sync. This is usually done with two data/information sources with different types as in data binding. However, in UI data binding, data and information objects of the same type are bound together (e.g. objects to Java UI elements).

If the binding has been made in the proper manner, then, each data change is reflected automatically by the elements that are bound to the data. The term data binding is also used in case where an outer representation of data in an element changes, and the underlying data is automatically updated to reflect this change. As an example, a change in a TextBox element could modify the underlying data value.

Ref:

WPF DataBinding: Windows Presentation Foundation () data binding provides a simple and consistent way for applications to present and interact with data. Elements can be bound to data from a variety of data sources in the form of common language runtime () objects and XML.

23688 questions
194
votes
5 answers

Difference between Observer, Pub/Sub, and Data Binding

What is the difference between the Observer Pattern, Publish/Subscribe, and Data Binding? I searched around a bit on Stack Overflow and did not find any good answers. What I have come to believe is that data binding is a generic term and there are…
193
votes
12 answers

Binding to static property

I'm having a hard time binding a simple static string property to a TextBox. Here's the class with the static property: public class VersionManager { private static string filterString; public static string FilterString { get {…
Anthony Brien
  • 6,106
  • 7
  • 43
  • 56
193
votes
8 answers

What is two way binding?

I have read lots that Backbone doesn't do two way binding but I don't exactly understand this concept. Could somebody give me an example of how two way binding works in an MVC codebase and how it does not with Backbone?
Chris M
  • 4,036
  • 4
  • 20
  • 26
177
votes
8 answers

Android Data Binding using include tag

Update note: The above example works properly, because release 1.0-rc4 fixed the issue of needing the unnecessary variable. Original question: I do exactly as it is described in the documentation and it does not work: main.xml:
167
votes
7 answers

Binding a list in @RequestParam

I'm sending some parameters from a form in this way: myparam[0] : 'myValue1' myparam[1] : 'myValue2' myparam[2] : 'myValue3' otherParam : 'otherValue' anotherParam : 'anotherValue' ... I know I can get all the params in the…
Javi
  • 19,387
  • 30
  • 102
  • 135
164
votes
10 answers

AngularJS : The correct way of binding to a service properties

I’m looking for the best practice of how to bind to a service property in AngularJS. I have worked through multiple examples to understand how to bind to properties in a service that is created using AngularJS. Below I have two examples of how to…
154
votes
4 answers

Use StringFormat to add a string to a WPF XAML binding

I have a WPF 4 application that contains a TextBlock which has a one-way binding to an integer value (in this case, a temperature in degrees Celsius). The XAML looks like this:
bmt22033
  • 6,880
  • 14
  • 69
  • 98
150
votes
7 answers

Binding a Button's visibility to a bool value in ViewModel

How do I bind the visibility of a button to a bool value in my ViewModel?
145
votes
35 answers

Data Binding class not generated

I am using Data Binding in my project, when using and in my xml binding class is not generated. For example i have activity_main.xml
Ravi
  • 34,851
  • 21
  • 122
  • 183
139
votes
4 answers

Spring MVC type conversion : PropertyEditor or Converter?

I am looking for the easiest and simplest way to bind and convert data in Spring MVC. If possible, without doing any xml configuration. So far I've been using PropertyEditors like so : public class CategoryEditor extends PropertyEditorSupport { …
Jerome Dalbert
  • 10,067
  • 6
  • 56
  • 64
138
votes
13 answers

I want to concat two strings for a TextView in android, Data Binding Api

Im using DataBinding Api for setting the views in android layouts. Here is my layout. layout.xml
138
votes
6 answers

Is there a way to chain multiple value converters in XAML?

I've got a situation in which I need to show an integer value, bound to a property on my data context, after putting it through two separate conversions: Reverse the value within a range (e.g. range is 1 to 100; value in datacontext is 90; user…
Mal Ross
  • 4,551
  • 4
  • 34
  • 46
137
votes
3 answers

How can I set the text of a WPF Hyperlink via data binding?

In WPF, I want to create a hyperlink that navigates to the details of an object, and I want the text of the hyperlink to be the name of the object. Right now, I have this:
rdeetz
  • 1,566
  • 2
  • 9
  • 8
134
votes
7 answers

Pushing read-only GUI properties back into ViewModel

I want to write a ViewModel that always knows the current state of some read-only dependency properties from the View. Specifically, my GUI contains a FlowDocumentPageViewer, which displays one page at a time from a FlowDocument.…
Joe White
  • 94,807
  • 60
  • 220
  • 330
130
votes
5 answers

How to force a WPF binding to refresh?

I have got a combo box with items source attached using simple binding. Is there any way to refresh this binding once combo box is loaded?
Techee
  • 1,755
  • 5
  • 14
  • 15