To access the value of your Entry
, you can do the following:
<Entry
x:Name="txtValue"
Keyboard="Numeric"/>
Note that I used the x:Name
property to set a name for its Entry
. By doing this, you can now access the element in your code.
namespace App4
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void Handle_Clicked (object sender, System.EventArgs e)
{
// Valor do Entry
var value = txtValue.Text;
await Navigation.PushAsync(new Page1());
}
}
}
To convert the value to double
, you can do this:
double newValue = Double.Parse(value);
To convert the value to decimal
, you can do this:
decimal newValue = Decimal.Parse(value);