Multi Select list using alert dialog

Hello everyone,
I using alert dialog for multi select in droid. it working good but there is one issue, when press on back button then selected items not remove. All selected items add in my list. I just want when user click on back button then just cancel currently selected items and only display previously selected items.
I used following code :


public class MultiSelectDialogClass : MvxDialogFragment
public MultiSelectDialog(int resourceId, string title)
this.resourceId = resourceId;
this.title = title;

    public override Dialog OnCreateDialog(Bundle savedState)

        var view = this.BindingInflate(this.resourceId, null);
        dialog = new AlertDialog.Builder(Activity);        

         dialog.SetPositiveButton(OK_TITLE, (s, a) => { });

          return dialog.Create();


public class MultiselectClass : MvxFragment

public override View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
var ignored = base.OnCreateView(inflater, container, savedInstanceState);

        var view = this.BindingInflate(Resource.Layout.multiSelectView, null);

        // To open multi select control 
        var uiAssigneUser = view.FindViewById<EditText>(Resource.Id.uiMultiSelect);

        if (uiAssigneUser != null)
            uiAssigneUser.Click += multiSelectOnClick;

  private void multiSelectOnClick(object sender, EventArgs eventArgs)

        var dialog = new MultiSelectDialog(Resource.Layout.MultiSelectView, "MULTISELECT");
        dialog.ViewModel = MultiSelectViewModel;
        dialog.Show(FragmentManager, "Multi-Users");


I tried Cancel(), Dispose() method but no luck. When click on back button then all recently select items added in list. I just want when press back button then reset all selected items.
Please help to resolve this issue.
thank you


  • BerayBentesenBerayBentesen TRUniversity ✭✭✭✭

    Hello, you can override OnBackPressed method and do whatever you want on that activity.

    public override void OnBackPressed ()
    base.OnBackPressed (); // or do something

  • UddhaoPachrneUddhaoPachrne INMember ✭✭

    @BerayBentesen I am using Fragment tab, so i can't override OnBackPressed ().

Sign In or Register to comment.