Forum Xamarin.Android

unable to lock the Entry .

Here the Entry was automatically empty while I move to another page, I want that the Entry will change or empty only when I made change on it. what can I do .

page1.xaml:

        <ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="NSF_app.setting">
    <StackLayout BackgroundColor="White" Padding="20"
    VerticalOptions="Center" HorizontalOptions="Fill">
    <Entry x:Name="UserEntry" 
    VerticalOptions="CenterAndExpand"
     InputTransparent="True" IsEnabled="False" IsReadOnly="True"/>
    <Button Text="read_Only" Clicked="Reado_OnClicked"/>
    <Button Text="Remove" Clicked="remove_OnClicked"/>
    </StackLayout>
</ContentPage>

page1.xaml.cs:
namespace NSF_app
{
public partial class page1
{

    public static string EntryValue = "";
    public page1()
    {
        InitializeComponent();
    }
    private void Reado_OnClicked(object sender, EventArgs e)
    {
        UserEntry.IsReadOnly = true;
        UserEntry.InputTransparent = true;
        UserEntry.IsEnabled = false;
    }

    private void remove_OnClicked(object sender, EventArgs e)
    {
        UserEntry.IsReadOnly = false;
        UserEntry.InputTransparent = false;
        UserEntry.IsEnabled = true;
    }
    }
}
Tagged:
Sign In or Register to comment.