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

How to properly pass the value of a label when a button is clicked in XAML?

$
0
0

I have a Label in a XAML code like this:

<Label 
 x:Name="lblPhoneNo" 
 Text="{Binding ConsumerPersonData.TelephoneNumber}" 
 Style="{StaticResource dataLabel}" 
 Grid.Row="3" > 
 Grid.Column="1" />

I want to pass the value of that Label in a CommandProperty when a button is click. My button code below:

<Button 
Text="Call" 
TextColor="White" 
WidthRequest="100" 
Command="{Binding CallCommand}" 
CommandParameter="{Binding ElementName=lblPhoneNo, Path=Text}"
BackgroundColor="{x:Static common:ColorResources.ButtonBackgroundColor}" /> 

What am I missing here?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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