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
6
votes
3 answers

What's the simplest way to display NULL values as "NULL" with WPF Data Binding?

I have this legacy database for which I'm building a custom viewer using Linq to Sql. Now some of the fields in a table can have the value NULL. Using normal databinding in a DataTemplate (typed for the Class generated by the ORM…
Gishu
  • 134,492
  • 47
  • 225
  • 308
6
votes
1 answer

Binding two Observable Collections with each other

I have two properties of ObservableCollection type (in separate projects); What I want to do is to bind these two using reflection and SetBinding like this - //Get the PropertyDescriptor for first collection property PropertyDescriptor…
akjoshi
  • 15,374
  • 13
  • 103
  • 121
6
votes
3 answers

Add newline to Stringformat in XAML

I'm binding the columnheaders of a datagrid to an observablecollection of dates, to display the day and date in the columnheader. This works fine. However, I would like to add a newline or break using the string. How can this be…
Mister 832
  • 1,177
  • 1
  • 15
  • 34
6
votes
5 answers

Spring MVC - Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer'

Am new to Spring MVC. I have developed a sample application which performs SELECT, INSERT, UPDATE and DELETE. Below is my Bean class @Id @Column private int student_id; private String name; private String age; private String city; private String…
Arpan Sharma
  • 395
  • 1
  • 10
  • 20
6
votes
1 answer

RecyclerView generic adapter with DataBinding

I have created generic adapter for RecyclerView by using DataBinding. Here is small code snippet public class RecyclerAdapter extends RecyclerView.Adapter { private final Context…
Ravi
  • 34,851
  • 21
  • 122
  • 183
6
votes
2 answers

Conditional operator with DataBinder.Eval

I want to do something like this <%#(DataBinder.Eval(Container, "DataItem.Age").ToString()=="0") ?"n/a" :"DataBinder.Eval(Container, "DataItem.Age")"%> is it possible?
vinit
  • 61
  • 1
  • 1
  • 2
6
votes
3 answers

position of ViewPager item with Data Binding

I have implemented ViewPager with use of android Data Binding, it is working perfect with data and click events. I have created interface for click event public interface ItemClickListener { public void onItemClick(); } Here is my…
Ravi
  • 34,851
  • 21
  • 122
  • 183
6
votes
2 answers

Coerce a WPF TextBox not working anymore in .NET 4.0

In my WPF application I have a TextBox where the user can enter a percentage (as int, between 1 and 100). The Text property is databound to a property in a ViewModel, where I coerce the value to be in the given range in the setter. However, in .NET…
Daniel Rose
  • 17,233
  • 9
  • 65
  • 88
6
votes
1 answer

Android data-binding - Can I access the enclosing activity in the layout XML?

I'd like to define an event listener in the XML that finishes the enclosing activity, like this:
Avi
  • 826
  • 6
  • 16
6
votes
2 answers

Android databinding and ternary operator (?:) to get drawables

I am trying to get drawables depending on if a function is false or true. But i am doing something wrong. So any help is appreciated
Jemil Riahi
  • 1,360
  • 5
  • 18
  • 38
6
votes
1 answer

Difference between on-change and ng-change

Below is a pretty straightforward setup for a form drop down list. However, the on-change event refuses to fire... unless it's changed to ng-change. This had me stuck for about an hour, since we use the same setup elsewhere in our site (i.e. model…
NealR
  • 10,189
  • 61
  • 159
  • 299
6
votes
1 answer

Android Data Binding Binding Adapter with class reference

I created this Binding Adapter @BindingAdapter("adapter") public static void setAdapter(RecyclerView view, RecyclerView.Adapter adapter) { view.setAdapter(adapter); } and set in…
Ihor Klimov
  • 898
  • 4
  • 15
  • 23
6
votes
1 answer

Dynamically toggle visibility of layout elements with Android data-binding.

I am building an Android app, where I want to toggle the visibility of some view elements based on a button click. I am trying to archive it with data-binding instead of using findViewById(), but all the solutions I've have found until now doesn't…
mutttenxd
  • 2,122
  • 1
  • 15
  • 19
6
votes
3 answers

Setting value of [(ngModel)] upon first page load in Angular 2

I am trying to create a simple select component which takes in some data via attributes and renders the required options. I plan to use this select component inside the template of another component, say PageComponent's template( page.template.html…
Praveen Puglia
  • 5,577
  • 5
  • 34
  • 68
6
votes
5 answers

Datacontext Lifetime in WinForm Binding Scenario

This one has been stumping me for a while. But I'm no expert. This is a bit long... I have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms…
Christopher Edwards
  • 6,589
  • 8
  • 43
  • 57