title: How to do binding in FXML, in JavaFX 2?
body: <p>Oracle docs aren't very clear on this, google and bing neither. </p>
  
  <p>Can I (like in WPF) bind to a model in FXML skipping the binding code in Java? </p>
  
  <p>I did see, for a brief flash, a syntax like ${object.field} on a blog somewhere but I can't be sure.</p>
  
  <hr>
  
  <p><strong>LATER EDIT</strong> : I have been doing XAML development (WPF, Silverlight, Windows Phone) for quite a few years and I've been accustomed to expressing databindings in the markup. Furthermore I've read in <a href="http://fxexperience.com/2011/10/fxml-why-it-rocks-and-the-next-phase/" rel="noreferrer">a 2011 article on FXExperience</a> that</p>
  
  <blockquote>
    <p>I could turn things around a little bit and move the binding into the FXML document. This would allow tools to handle data binding in addition to layout. Note that the following code does not work today because bidirectional bindings are not supported in FXML, but we are working on fixing that.</p>
  </blockquote>
  
  <p>Practically it was like :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import fxmlapp.Model ?&gt;
  
  &lt;VBox fx:id="root" xmlns:fx="http://javafx.com/fxml" fx:controller="fxmlapp.Sample"&gt;
      &lt;fx:define&gt;
          &lt;Model fx:id="model" /&gt;
      &lt;/fx:define&gt;
      &lt;children&gt;
          &lt;TextField fx:id="firstNameField" text="${model.person.firstName}" /&gt;
          &lt;Label fx:id="messageLabel" text="${model.person.firstName}" /&gt;
      &lt;/children&gt;
  &lt;/VBox&gt;
  </code></pre>
  
  <p>Since it was in a 2011 article things could have been implemented in the meanwhile, but have not found any evidence in this direction. Therefore, after careful searching, I decided to ask here.</p>