Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

How do i bind a property text of the label

$
0
0

I have this layout

<Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <BoxView Color="Red" Grid.Row="0" Grid.Column="0" />
                        <BoxView Color="Green" Grid.Row="0" Grid.Column="1" />
                        <BoxView Color="Green" Grid.Row="1" Grid.Column="0" />
                        <BoxView Color="Green" Grid.Row="1" Grid.Column="1" />

                        <BoxView Color="Green" Grid.Row="2" Grid.Column="0" />
                        <BoxView Color="Green" Grid.Row="2" Grid.Column="1" />
                        <BoxView Color="Yellow" Grid.Row="3" Grid.Column="0" />

            <Image Source="{local:ImageResource TesteAutenticacaoForms.Images.ico-cobranca-mensalista.png}" Grid.Row="0" Grid.Column="0" >
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Tapped="OnTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
                    </Image.GestureRecognizers>
                     </Image>


                        <Label Text="Test1" Grid.Row="0" Grid.Column="0" TextColor="White" FontAttributes="Bold"/>
                        <Label Text="Test2" Grid.Row="0" Grid.Column="0" VerticalOptions="EndAndExpand" HorizontalOptions="Center" TextColor="White" FontAttributes="Bold"/>
                    </Grid>

and i have this in my .cs

private doubl teste;
public double Teste
{
  get
      {return this.Teste = teste;}
  private set
      {this Teste = value}
}

void OnTapGestureTapped(object sender, EventsAgrs e)
{
    Class_A class_a = new Class_A();
    class_a = MethodCallingService(parameter1, parameter2); ==> this ok
    foreach(var item in class_a)
    {
        teste = item.Valor;
    }
}

public class Class_A : List<Class_B>
{}

public class Class_B
{
    public string Nome { get; set; }
    public double Valor { get; set; }
}

i need to set text property for label. How? I tried this way and isn't work. Text is missed.

<Label Text="{Binding Teste}".... />


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>