Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Returning selected item and closing Single Choice Alert Dialog

$
0
0

I've got a single choice alert dialog working, but I can't figure out how to access to OK/Cancel event to return my selected item and close the alert.

Here's what I have now...

    btnChooseJobType.Click += (sender, e) => {
        AlertDialog.Builder ad = new AlertDialog.Builder(this);
        ad.SetTitle("Make your selection");
        ad.SetSingleChoiceItems(jobtypes, -1, JobTypeListClicked); //this works but I don't want it to return the value at this point.
        ad.SetPositiveButton("OK", delegate....//NOT SURE WHAT TO PUT HERE...
        ad.Show();
    };


        private void JobTypeListClicked(object sender, DialogClickEventArgs eventargs)
        {
            Toast.MakeText(this, string.Format("Job Type: {0}", jobtypes[eventargs.Which]), ToastLength.Short).Show();
        }

The toast shows me the result when I select it, but I need to return the value to the parent activity when the OK button is clicked.

Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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