TeaLight Wiki
Advertisement

How to bind to a command[]

A binding is used to connect a control property to a model property. Binding as then used to move the data in the one property to the other property.

The current implementation of TeaLight allows for for binding of data properties and command properties. The implementations are on different levels per platform.

Levels:

  1. Not implemented
  2.  Rendering SourcePropertyPath and Mode
  3. Render all



Android[]

Binding a click command to a button. Using the json structure

<Button
    ...
    local:MvxBind="{'Click':{'Path':'ThruCommand'}}" />

Using the Swiss Bindings structure

<Button
    ...
    local:MvxBind="Click ThruCommand" />

StackOverflow


Binding data to a text view

Using the json structure

  <TextView android:id="@+id/name"

          local:MvxBind="{'Text':{'Path':'Name'}}"  />

Using the Swiss Bindings structure <TextView android:id="@+id/name"

          local:MvxBind="Text Name"  />


Windows[]

Binding a click command to a button.

<Button Command="{Binding SaveCommand}" >

Binding data to a text view

<TextBox Text="{Binding Name,  Mode=TwoWay}" />


Touch[]

Advertisement