public SortDialog(SortController controller, Activity context, View anchor)
        {
            this.controller = controller;
            this.context    = context;
            this.anchor     = anchor;

            columnChangeListener = new SortColumnChangeListener(this);
            typeChangeListener   = new SortTypeChangeListener(this);

            mainView = context.LayoutInflater.Inflate(Resource.Layout.SortPopup, null, false);
            mainView.SetBackgroundColor(Color.White);

            sortsList = mainView.FindViewById <LinearLayout>(Resource.Id.linearLayoutSortsList);

            View closeButton = mainView.FindViewById(Resource.Id.imageButtonClose);

            closeButton.SetOnClickListener(this);

            View saveButton = mainView.FindViewById(Resource.Id.buttonSave);

            saveButton.SetOnClickListener(this);

            View addButton = mainView.FindViewById(Resource.Id.relativeLayoutAddSort);

            addButton.SetOnClickListener(this);

            retView = new PopupWindow(context)
            {
                ContentView = mainView
            };

            retView.SetOnDismissListener(this);

            controller.HookView(this);
        }
 public void OnDismiss()
 {
     this.controller = null;
     this.context    = null;
     this.Dispose();
 }