Questions tagged [data-binding]
A general technique that binds two data/information sources together and maintains them in sync.
23,836
questions
2050
votes
14
answers
359k
views
How does data binding work in AngularJS?
How does data binding work in the AngularJS framework?
I haven't found technical details on their site. It's more or less clear how it works when data is propagated from view to model. But how does ...
1012
votes
51
answers
1.4m
views
Jackson with JSON: Unrecognized field, not marked as ignorable
I need to convert a certain JSON string to a Java object. I am using Jackson for JSON handling. I have no control over the input JSON (I read from a web service). This is my input JSON:
{"wrapper":[{"...
670
votes
14
answers
524k
views
How do I use WPF bindings with RelativeSource?
How do I use RelativeSource with WPF bindings and what are the different use-cases?
476
votes
11
answers
170k
views
How to bind RadioButtons to an enum?
I've got an enum like this:
public enum MyLovelyEnum
{
FirstSelection,
TheOtherSelection,
YetAnotherOne
};
I got a property in my DataContext:
public MyLovelyEnum VeryLovelyEnum { get; ...
378
votes
14
answers
82k
views
INotifyPropertyChanged vs. DependencyProperty in ViewModel
When implementing the ViewModel in a Model-View-ViewModel architecture WPF application there seem to be two major choices how to make it databindable. I have seen implementations that use ...
329
votes
1
answer
123k
views
ListBox vs. ListView - how to choose for data binding
I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to ...
298
votes
15
answers
207k
views
How to Implement DOM Data Binding in JavaScript
Please treat this question as strictly educational. I'm still interested in hearing new answers and ideas to implement this
tl;dr
How would I implement bi-directional data-binding with JavaScript?
...
283
votes
14
answers
280k
views
Ng-model does not update controller value
Probably silly question, but I have my html form with simple input and button:
<input type="text" ng-model="searchText" />
<button ng-click="check()">Check!</button>
{{ searchText }}...
280
votes
15
answers
581k
views
Angular 2 Checkbox Two Way Data Binding
I´m fairly new to Angular2 and I have a little problem:
In my Login-Component-HTML, I have two checkboxes, which I want to bind in two way data-binding to the Login-Component-TypeScript.
This is the ...
260
votes
4
answers
255k
views
How to bind multiple values to a single WPF TextBlock?
I'm currently using the TextBlock below to bind the value of a property named Name:
<TextBlock Text="{Binding Name}" />
Now, I want to bind another property named ID to the same TextBlock.
Is ...
236
votes
3
answers
212k
views
WPF Databinding: How do I access the "parent" data context?
I have a list (see below) contained in a window. The window's DataContext has two properties, Items and AllowItemCommand.
How do I get the binding for the Hyperlink's Command property needs to ...
218
votes
22
answers
273k
views
How to bind an enum to a combobox control in WPF?
I am trying to find a simple example where the enums are shown as is. All examples I have seen tries to add nice looking display strings but I don't want that complexity.
Basically I have a class ...
208
votes
4
answers
690k
views
Binding a WPF ComboBox to a custom list
I have a ComboBox that doesn't seem to update the SelectedItem/SelectedValue.
The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a ...
206
votes
7
answers
229k
views
AngularJS - Binding radio buttons to models with boolean values
I am having a problem binding radio buttons to an object whose properties have boolean values. I am trying to display exam questions retrieved from a $resource.
HTML:
<label data-ng-repeat="...
204
votes
5
answers
87k
views
KnockOutJS - Multiple ViewModels in a single View
I'm thinking that my application is getting quite large now, too large to handle each View with a single ViewModel.
So I'm wondering how difficult it would be to create multiple ViewModels and load ...
197
votes
5
answers
52k
views
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 ...
194
votes
12
answers
212k
views
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;
...
194
votes
8
answers
139k
views
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 ...
181
votes
8
answers
112k
views
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 ...
170
votes
7
answers
350k
views
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'
...
164
votes
10
answers
116k
views
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 ...
160
votes
4
answers
271k
views
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:
<TextBlock x:Name="...
153
votes
7
answers
196k
views
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?
<Button Height="50" Width="50" Style="{StaticResource MyButtonStyle}"
Command="{Binding SmallDisp}" CommandParameter="{...
150
votes
36
answers
127k
views
Data Binding class not generated
I am using Data Binding in my project, when using <layout> and <data> in my xml binding class is not generated.
For example i have activity_main.xml
<?xml version="1.0" encoding="utf-...
141
votes
6
answers
58k
views
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 ...
139
votes
13
answers
92k
views
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
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/...
139
votes
3
answers
81k
views
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:
<TextBlock><...
138
votes
4
answers
51k
views
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 ...
134
votes
7
answers
49k
views
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 ...
133
votes
4
answers
71k
views
Android : Difference between DataBinding and ViewBinding
We are using DataBinding since Jetpack release. Android documentation indicates that ViewBinding was added in Android Studio 3.6 Canary 11+.
I read the documentation but its looks similar to ...
132
votes
5
answers
164k
views
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?
129
votes
8
answers
122k
views
How do I bind a WPF DataGrid to a variable number of columns?
My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A ...
126
votes
7
answers
137k
views
Access parent DataContext from DataTemplate
I have a ListBox which binds to a child collection on a ViewModel. The listbox items are styled in a DataTemplate based on a property on the parent ViewModel:
<Style x:Key="...
125
votes
1
answer
44k
views
How to do two-way filtering in AngularJS?
One of the interesting things AngularJS can do is apply a filter to a particular databinding expression, which is a convenient way to apply, for example, culture-specific currency or date formatting ...
123
votes
15
answers
448k
views
Angular 2 two way binding using ngModel is not working
Can't bind to 'ngModel' since it isn't a know property of the 'input' element and there are no matching directives with a corresponding property
Note: im using alpha.31
import { Component, View, ...
123
votes
11
answers
71k
views
Detecting WPF Validation Errors
In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the ExceptionValidationRule or DataErrorValidationRule.
Suppose you had a bunch of controls set up ...
119
votes
7
answers
446k
views
How to bind a List to a ComboBox?
I want to connect a BindingSource to a list of class objects and then objects value to a ComboBox.
Can anyone suggest how to do it?
public class Country
{
public string Name { get; set; }
...
116
votes
12
answers
103k
views
How to format TimeSpan in XAML
I am trying to format a textblock which is bound to a TimeSpan property. It works if the property is of type DateTime but it fails if it is a TimeSpan. I can get it done using a converter. But I am ...
113
votes
4
answers
128k
views
How to set a binding in Code?
I have the need to set a binding in code.
I can't seem to get it right tho.
This is what i have tried:
XAML:
<TextBox Name="txtText"></TextBox>
Code behind:
Binding myBinding = new ...
110
votes
3
answers
252k
views
How to format number of decimal places in wpf using style/template?
I am writing a WPF program and I am trying to figure out a way to format data in a TextBox through some repeatable method like a style or template. I have a lot of TextBoxes (95 to be exact) and each ...
107
votes
7
answers
93k
views
ASP.NET Repeater bind List<string>
I am binding a List<string> to a Repeater control. Now I want to use the Eval function
to display the contents in ItemTemplate like
<%# Eval("NAME") %>.
But I am not sure what I ...
106
votes
2
answers
83k
views
What are the various WPF binding modes?
I do not understand the various data binding modes in WPF, such as:
One-Way
Two-Way
One-Time
etc...
What does each of these modes mean?
When should they be used?
106
votes
4
answers
70k
views
Passing current scope to an AngularJS Service
Is it correct to pass the "current" $scope to an AngularJS service?
I'm in the situation where I've a $service knowing it's consumed by only one controller, and I'd like to have a reference to the ...
104
votes
2
answers
118k
views
What does "{Binding Path=.}" mean in WPF binding?
What does {Binding Path=.} mean in a WPF binding?
I see some people use it, but couldn't find any explanation.
Are there any other special symbols in binding syntax (other than {Binding /})?
104
votes
2
answers
87k
views
List<T> vs BindingList<T> Advantages/DisAdvantages
Can someone describe what the difference between the two are for my project.
Currently I have a List<MyClass> and set the BindingSource to that and a DataGridView to the BindingSource.
I have ...
103
votes
10
answers
189k
views
AngularJS : ng-model binding not updating when changed with jQuery
This is my HTML:
<input id="selectedDueDate" type="text" ng-model="selectedDate" />
When I type into the box, the model is updated via the 2-way-binding mechanism. Sweet.
However when I do ...
101
votes
8
answers
40k
views
What approaches are available to dummy design-time data in WPF?
I am working without expression blend and just using the XAML editor in vs2010. The wisdom of this aside, I am increasingly seeing a need for design-time data binding. For simple cases, the ...
101
votes
6
answers
121k
views
WPF Data Binding and Validation Rules Best Practices
I have a very simple WPF application in which I am using data binding to allow editing of some custom CLR objects. I am now wanting to put some input validation in when the user clicks save. However, ...
99
votes
2
answers
113k
views
WPF Bind to itself
I've got a WPF Window, and somewhere there is a ListView where I bind a List<string> to.
Now somewhere in my ListView there is a TextBox and the Content property is set to {Binding}.
But this ...
99
votes
16
answers
47k
views
WPF CommandParameter is NULL first time CanExecute is called
I have run into an issue with WPF and Commands that are bound to a Button inside the DataTemplate of an ItemsControl. The scenario is quite straight forward. The ItemsControl is bound to a list of ...