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

How to bind the logged in `player data` retrieved from database to populate in Register.xaml view.

$
0
0

In my Xamarin Forms app, how to bind the logged in player data retrieved from database to populate in Register.xaml view. This should be done on OnProfilePicClicked method

Register.xaml

<ContentPage.Content>







</ContentPage.Content>

MainPage.xaml.cs class:

private async void OnProfilePicClicked(object sender, EventArgs e)
{
//Navigate to Register screen with player data loaded:
var emailText = emailEntry.Text;
await Navigation.PushAsync(new Register(){});
List details = (from x in conn.Table() where x.Email == emailText select x).ToList();
if (details!= null)
{
// found the record here, but how to pass to view...

            PlayerDetails playerDetails = new PlayerDetails();
            playerDetails.FullName = details[0].FullName;
            playerDetails.Mobile = details[0].Mobile;
            playerDetails.SoccerPosition = details[0].SoccerPosition;
        }

    }

**PlayerDetails model class : **

string fullname;
string mobile;
string soccerposition;

    public PlayerDetails()
    {

    }

    public string FullName
    {
        set
        {
            if (fullname != value)
            {
                fullname = value;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("FullName"));
                }
            }
        }
        get
        {
            return fullname;
        }
    }

    public string Mobile
    {
        set
        {
            if (mobile != value)
            {
                mobile = value;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Mobile"));
                }
            }
        }
        get
        {
            return mobile;
        }

    }

    public string SoccerPosition
    {
        set
        {
            if (soccerposition != value)
            {
                soccerposition = value;

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("SoccerPosition"));
                }
            }
        }
        get
        {
            return soccerposition;
        }
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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