<BindingExample>
<Label Text="{Player}" />
</BindingExample>
public class BindingExample : UIView
{
public string Player;
public void ChangePlayer()
{
SetValue(() => Player, "Player Name"); // changes are propagated to Label.Text
}
}
public class BindingExample : UIView
{
public _string Player;
public void ChangePlayer()
{
Player.Value = "Player Name";
}
}
<BindingExample>
<Group>
<Label Id="Label1" Text="{PlayerName.FirstName}" />
<Label Text="{Label1.Text}" />
</Group>
</BindingExample>
public class BindingExample : UIView
{
public _int Value1;
public _int Value2;
public _int Value3;
public int Sum(int a, int b, int c)
{
return a + b + c;
}
}
<BindingExample>
<Label Text="$Sum({Value1}, {Value2}, {Value3})" />
</BindingExample>
<BindingExample>
<Label Text="Hello {FirstName} {LastName}!" />
</BindingExample>
<BindingExample>
<Label Text="{Value:0.0} %" />
</BindingExample>
<BindingExample>
<Label Text="{=Player}" />
</BindingExample>
<BindingExample>
<Label Text="{#Theme}" />
</BindingExample>
<BindingExample>
<List Items="{Highscores}">
<ListItem IsTemplate="True" Text="{#Item.Score}" />
</List>
</BindingExample>
<BindingExample>
<CheckBox Text="Shield Deactivated" IsChecked="{!ShieldActive}" />
</BindingExample>
<BindingExample>
<Label Text="{@Loc.Greeting}" />
</BindingExample>
Binding | Example Syntax |
---|---|
Two-way Binding |
<Label Text="{Player}" /> <Label Text="{PlayerName.FirstName}" /> <Label Text="{Label1.Text}" />
|
One-way Binding | <Label Text="{=Player}" /> |
Multi Binding |
<Label Text="$Sum({Value1}, {Value2})" /> <Label Text="$MyView.StaticMethod({v1}, {v2})" />
|
Format String |
<Label Text="Hello {FirstName} {LastName}!" /> <Label Text="{Progress:0.0} %" /> |
Local Binding |
<Label Text="{#Theme}" />
|
List Item Binding |
<Label Text="{#Item.Score}" />
|
Negated Binding |
<CheckBox IsChecked="{!ShieldActive}" />
|
Resource Binding |
<Label Text="{@Loc.Greeting}" /> <Label Text="{@GameTitle}" />
|
Negated One-way Local |
<Label Text="{!=#IsActive}" />
|
Be notified when new themes, views, tutorials and updates are available