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? Data Binding to the DOM By data binding to the DOM I mean for example, having a JavaScript object a with a property b. Then having an … Read more

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 search/sort/filter based on user input. The data binding demo (http://msdn.microsoft.com/en-us/library/ms771319.aspx) uses a ListBox with a CollectionViewSource. Does anyone have … Read more

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 DependencyProperty for properties the View is going to bind against and I have seen the ViewModel implementing INotifyPropertyChanged instead. My question is when should I prefer one … Read more

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; set; } And I got three RadioButtons in my WPF client. <RadioButton Margin=”3″>First Selection</RadioButton> <RadioButton Margin=”3″>The Other Selection</RadioButton> <RadioButton Margin=”3″>Yet Another one</RadioButton> Now how do I bind the RadioButtons … Read more

How do I use WPF bindings with RelativeSource?

How do I use RelativeSource with WPF bindings and what are the different use-cases? 14 s 14 If you want to bind to another property on the object: {Binding Path=PathToProperty, RelativeSource={RelativeSource Self}} If you want to get a property on an ancestor: {Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}} If you want to get a property on … Read more

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”:[{“id”:”13″,”name”:”Fred”}]} Here is a simplified use case: private void tryReading() { String jsonStr = “{\”wrapper\”\:[{\”id\”:\”13\”,\”name\”:\”Fred\”}]}”; ObjectMapper mapper … Read more

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 AngularJS track changes of model properties without setters and getters? I found that there are JavaScript watchers that may … Read more

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”:[{“id”:”13″,”name”:”Fred”}]} Here is a simplified use case: private void tryReading() { String jsonStr = “{\”wrapper\”\:[{\”id\”:\”13\”,\”name\”:\”Fred\”}]}”; ObjectMapper mapper … Read more