{"action":"created","comment":{"url":"https://api.github.com/repos/NativeScript/docs/pulls/comments/42973299","id":42973299,"diff_hunk":"@@ -7,92 +7,121 @@ position: 6\n \n #Data Binding\n \n-##Overview\n+Data binding is the process of connecting application user interface (UI) to a data object (code). There are two different ways for propagating а change. It is possible to update the source code through the UI componets and vise versa - to reflect in the UI the changes from modifying the code.\n \n-Data binding is the process of connecting application user interface (UI) to a data object (business model). With a correct data binding settings and if data object provides proper notifications then when data changes application UI will reflect changes accordingly (source to target). Depending on settings and requirements there is a possibility to update data from UI to data object (target to source).\n+> **source** is used as any object in the code, and **target** as any UI control (like TextField).\n \n-> **source** is used as any business logic object, and **target** as any UI control (like TextField).\n+* [Data Flow Direction](#data-flow-direction)\n+* [Basic Binding Concepts](#basic-binding-concepts)\n+* [Create a Binding](#create-a-binding)\n+    * [TwoWay Binding in Code](#twoway-binding-in-code)\n+    * [Binding in XML](#binding-in-xml)\n+* [Binding Source](#binding-source)\n+\t* [Biding to a Property](#biding-to-a-property)\n+\t* [Binding to an Event in XML](#binding-to-an-event-in-xml)\n+\t* [Binding to a Plain Object](#binding-to-a-plain-object)\n+\t* [Binding to a Parent Binding Context](#binding-to-a-parent-binding-context)\n+* [Using Expressions for Bindings](#using-expressions-for-bindings)\n+\t* [Supported Expressions](#supported-expressions)\n+* [Using Converters in Bindings](#using-converters-in-bindings)\n+* [Stop Binding](#stop-binding)\n \n-##Basic data binding concepts\n+##Data Flow Direction\n \n-Generally almost every UI control (since all controls are created with data binding in mind) could be bound to a data object. However there are few restrictions for data binding to work out of the box.\n+Part of the data binding settings is the way data flows. NativeScript data binding supports the following data transmissions.\n \n-* Target object should be a successor of **Bindable** class. This is the case with all NativeScript UI controls.\n-* Target property should be a **dependency property** in order to use data binding from target to source (or two way data binding). A plain property could be used if there is no need of **twoWay** binding.\n-* Data (business) object should raise **propertyChange** event for every change in the value of the property.\n+* **OneWay** - the default setting, guaranteeing the update of the target property, when a change is made in the source property. Contrary, a change in the UI will not be propagated back to the code. If such a change is made, it will stop the binding connection.\n \n-##Direction of data flow\n+* **TwoWay** - this setting ensures the reflexion of changes in both directions - from target to source and source to target. It is very useful in the cases when user input should be handled. ","path":"bindings.md","position":38,"original_position":38,"commit_id":"1e2453c2dd72eb20345ed7bef8caf48967970ecc","original_commit_id":"1e2453c2dd72eb20345ed7bef8caf48967970ecc","user":{"login":"ikoevska","id":3539221,"avatar_url":"https://avatars.githubusercontent.com/u/3539221?v=3","gravatar_id":"","url":"https://api.github.com/users/ikoevska","html_url":"https://github.com/ikoevska","followers_url":"https://api.github.com/users/ikoevska/followers","following_url":"https://api.github.com/users/ikoevska/following{/other_user}","gists_url":"https://api.github.com/users/ikoevska/gists{/gist_id}","starred_url":"https://api.github.com/users/ikoevska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikoevska/subscriptions","organizations_url":"https://api.github.com/users/ikoevska/orgs","repos_url":"https://api.github.com/users/ikoevska/repos","events_url":"https://api.github.com/users/ikoevska/events{/privacy}","received_events_url":"https://api.github.com/users/ikoevska/received_events","type":"User","site_admin":false},"body":"We're using US spelling and grammar in general. Go with reflection.","created_at":"2015-10-26T09:43:24Z","updated_at":"2015-10-26T09:43:24Z","html_url":"https://github.com/NativeScript/docs/pull/167#discussion_r42973299","pull_request_url":"https://api.github.com/repos/NativeScript/docs/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/comments/42973299"},"html":{"href":"https://github.com/NativeScript/docs/pull/167#discussion_r42973299"},"pull_request":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/NativeScript/docs/pulls/167","id":48334837,"html_url":"https://github.com/NativeScript/docs/pull/167","diff_url":"https://github.com/NativeScript/docs/pull/167.diff","patch_url":"https://github.com/NativeScript/docs/pull/167.patch","issue_url":"https://api.github.com/repos/NativeScript/docs/issues/167","number":167,"state":"open","locked":false,"title":"Data Binding article - restructured and rewritten","user":{"login":"N3ll","id":12541122,"avatar_url":"https://avatars.githubusercontent.com/u/12541122?v=3","gravatar_id":"","url":"https://api.github.com/users/N3ll","html_url":"https://github.com/N3ll","followers_url":"https://api.github.com/users/N3ll/followers","following_url":"https://api.github.com/users/N3ll/following{/other_user}","gists_url":"https://api.github.com/users/N3ll/gists{/gist_id}","starred_url":"https://api.github.com/users/N3ll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/N3ll/subscriptions","organizations_url":"https://api.github.com/users/N3ll/orgs","repos_url":"https://api.github.com/users/N3ll/repos","events_url":"https://api.github.com/users/N3ll/events{/privacy}","received_events_url":"https://api.github.com/users/N3ll/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-21T14:00:40Z","updated_at":"2015-10-26T09:43:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ea34ddf5a7fda4b51dcfd3143d46efb9d231676","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NativeScript/docs/pulls/167/commits","review_comments_url":"https://api.github.com/repos/NativeScript/docs/pulls/167/comments","review_comment_url":"https://api.github.com/repos/NativeScript/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NativeScript/docs/issues/167/comments","statuses_url":"https://api.github.com/repos/NativeScript/docs/statuses/1e2453c2dd72eb20345ed7bef8caf48967970ecc","head":{"label":"NativeScript:data-binding-article","ref":"data-binding-article","sha":"1e2453c2dd72eb20345ed7bef8caf48967970ecc","user":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"repo":{"id":20398807,"name":"docs","full_name":"NativeScript/docs","owner":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NativeScript/docs","description":"Docs, API Reference and Code Snippets for NativeScript","fork":false,"url":"https://api.github.com/repos/NativeScript/docs","forks_url":"https://api.github.com/repos/NativeScript/docs/forks","keys_url":"https://api.github.com/repos/NativeScript/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NativeScript/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NativeScript/docs/teams","hooks_url":"https://api.github.com/repos/NativeScript/docs/hooks","issue_events_url":"https://api.github.com/repos/NativeScript/docs/issues/events{/number}","events_url":"https://api.github.com/repos/NativeScript/docs/events","assignees_url":"https://api.github.com/repos/NativeScript/docs/assignees{/user}","branches_url":"https://api.github.com/repos/NativeScript/docs/branches{/branch}","tags_url":"https://api.github.com/repos/NativeScript/docs/tags","blobs_url":"https://api.github.com/repos/NativeScript/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NativeScript/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NativeScript/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/NativeScript/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NativeScript/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/NativeScript/docs/languages","stargazers_url":"https://api.github.com/repos/NativeScript/docs/stargazers","contributors_url":"https://api.github.com/repos/NativeScript/docs/contributors","subscribers_url":"https://api.github.com/repos/NativeScript/docs/subscribers","subscription_url":"https://api.github.com/repos/NativeScript/docs/subscription","commits_url":"https://api.github.com/repos/NativeScript/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/NativeScript/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/NativeScript/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/NativeScript/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/NativeScript/docs/contents/{+path}","compare_url":"https://api.github.com/repos/NativeScript/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NativeScript/docs/merges","archive_url":"https://api.github.com/repos/NativeScript/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NativeScript/docs/downloads","issues_url":"https://api.github.com/repos/NativeScript/docs/issues{/number}","pulls_url":"https://api.github.com/repos/NativeScript/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/NativeScript/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/NativeScript/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NativeScript/docs/labels{/name}","releases_url":"https://api.github.com/repos/NativeScript/docs/releases{/id}","created_at":"2014-06-02T09:28:14Z","updated_at":"2015-10-20T14:12:08Z","pushed_at":"2015-10-22T13:16:36Z","git_url":"git://github.com/NativeScript/docs.git","ssh_url":"git@github.com:NativeScript/docs.git","clone_url":"https://github.com/NativeScript/docs.git","svn_url":"https://github.com/NativeScript/docs","homepage":null,"size":11353,"stargazers_count":223,"watchers_count":223,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":30,"forks":47,"open_issues":30,"watchers":223,"default_branch":"production"}},"base":{"label":"NativeScript:master","ref":"master","sha":"2071ca13a61191f891868bc95ad3fa16ab2b3fb0","user":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"repo":{"id":20398807,"name":"docs","full_name":"NativeScript/docs","owner":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NativeScript/docs","description":"Docs, API Reference and Code Snippets for NativeScript","fork":false,"url":"https://api.github.com/repos/NativeScript/docs","forks_url":"https://api.github.com/repos/NativeScript/docs/forks","keys_url":"https://api.github.com/repos/NativeScript/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NativeScript/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NativeScript/docs/teams","hooks_url":"https://api.github.com/repos/NativeScript/docs/hooks","issue_events_url":"https://api.github.com/repos/NativeScript/docs/issues/events{/number}","events_url":"https://api.github.com/repos/NativeScript/docs/events","assignees_url":"https://api.github.com/repos/NativeScript/docs/assignees{/user}","branches_url":"https://api.github.com/repos/NativeScript/docs/branches{/branch}","tags_url":"https://api.github.com/repos/NativeScript/docs/tags","blobs_url":"https://api.github.com/repos/NativeScript/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NativeScript/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NativeScript/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/NativeScript/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NativeScript/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/NativeScript/docs/languages","stargazers_url":"https://api.github.com/repos/NativeScript/docs/stargazers","contributors_url":"https://api.github.com/repos/NativeScript/docs/contributors","subscribers_url":"https://api.github.com/repos/NativeScript/docs/subscribers","subscription_url":"https://api.github.com/repos/NativeScript/docs/subscription","commits_url":"https://api.github.com/repos/NativeScript/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/NativeScript/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/NativeScript/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/NativeScript/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/NativeScript/docs/contents/{+path}","compare_url":"https://api.github.com/repos/NativeScript/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NativeScript/docs/merges","archive_url":"https://api.github.com/repos/NativeScript/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NativeScript/docs/downloads","issues_url":"https://api.github.com/repos/NativeScript/docs/issues{/number}","pulls_url":"https://api.github.com/repos/NativeScript/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/NativeScript/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/NativeScript/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NativeScript/docs/labels{/name}","releases_url":"https://api.github.com/repos/NativeScript/docs/releases{/id}","created_at":"2014-06-02T09:28:14Z","updated_at":"2015-10-20T14:12:08Z","pushed_at":"2015-10-22T13:16:36Z","git_url":"git://github.com/NativeScript/docs.git","ssh_url":"git@github.com:NativeScript/docs.git","clone_url":"https://github.com/NativeScript/docs.git","svn_url":"https://github.com/NativeScript/docs","homepage":null,"size":11353,"stargazers_count":223,"watchers_count":223,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":30,"forks":47,"open_issues":30,"watchers":223,"default_branch":"production"}},"_links":{"self":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/167"},"html":{"href":"https://github.com/NativeScript/docs/pull/167"},"issue":{"href":"https://api.github.com/repos/NativeScript/docs/issues/167"},"comments":{"href":"https://api.github.com/repos/NativeScript/docs/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NativeScript/docs/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/NativeScript/docs/statuses/1e2453c2dd72eb20345ed7bef8caf48967970ecc"}}}}