Ross Attrill
Ross Attrill

Reputation: 2702

Unable to bind view state to model

I am trying to bind my view currentState to a state variable that I have in my injected presentation model class.

If I do this:

<fx:Binding source="{model.state}" destination="{this.currentState}">

then I get an compiler error message [project_name]: Initializer for 'destination': data binding expression not allowed here. The UIComponent property currentState has a public setter.

Why can't I make my view currentState property the target of binding?

Upvotes: 0

Views: 181

Answers (1)

Ross Attrill
Ross Attrill

Reputation: 2702

The answer from @RIAStar works (see comments above). It is also possible to bind to currentState in the MXML constructor as indicated below:

<?xml version="1.0"?>
<s:Group
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        currentState="{model.state}"
        >

Upvotes: 1

Related Questions