Created
February 17, 2011 01:35
-
-
Save mgroves/830755 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using Android.App; | |
| using Android.Content; | |
| using Android.Widget; | |
| using Android.OS; | |
| namespace MonoDroidMultiChoice | |
| { | |
| [Activity(Label = "MonoDroidMultiChoice", MainLauncher = true)] | |
| public class Activity1 : Activity | |
| { | |
| int count = 1; | |
| protected override void OnCreate(Bundle bundle) | |
| { | |
| base.OnCreate(bundle); | |
| // Set our view from the "main" layout resource | |
| SetContentView(Resource.Layout.Main); | |
| // Get our button from the layout resource, | |
| // and attach an event to it | |
| Button button = FindViewById<Button>(Resource.Id.MyButton); | |
| button.Click += new EventHandler(button_Click); | |
| } | |
| void button_Click(object sender, EventArgs e) | |
| { | |
| IEnumerable<char>[] stockItemsDisplay = new List<string> | |
| {"option1", "option2", "option3", "fourth option", "last"} | |
| .Select(i => i.AsEnumerable()).ToArray(); | |
| bool[] allitemschecked = new[] {true, false, false, true, false}; | |
| var dialog = new AlertDialog.Builder(this); | |
| dialog.SetMultiChoiceItems(stockItemsDisplay, allitemschecked, clickCallback); | |
| dialog.SetTitle("Select columns"); | |
| dialog.SetPositiveButton("Save", saveCallback); | |
| dialog.Create().Show(); | |
| } | |
| private void clickCallback(object sender, DialogMultiChoiceClickEventArgs e) {} | |
| private void saveCallback(object sender, DialogClickEventArgs e) {} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment