public PopupItemSelection(Func <IItem, bool> ExtraFilterFunction = null, Func <IItem, bool> AllowSelectFunction = null)
        {
            InitializeComponent();
            CurrentPopup = this;

            if (ItemSelect == null)
            {
                ItemSelect = new ItemSelectControl();
                ItemSelect.RawItemSelected    += ItemSelect_RawItemSelected;
                ItemSelect.ItemConfirmed      += ItemSelect_ItemConfirmed;
                ItemSelect.LockUiFunction      = LockUi;
                ItemSelect.UnlockUiFunction    = UnlockUi;
                ItemSelect.ExpandCharacterMenu = true;
            }

            _selectFunction = AllowSelectFunction;
            ItemSelect.ExtraSearchFunction = ExtraFilterFunction;

            ItemSelect.ClearSelection();
            ItemSelect.DoFilter();


            Loaded   += PopupItemSelection_Loaded;
            Unloaded += PopupItemSelection_Unloaded;
        }
        public static IItem ShowItemSelection(Func <IItem, bool> ExtraFilterFunction = null, Func <IItem, bool> AllowSelectFunction = null)
        {
            var wind   = new PopupItemSelection(ExtraFilterFunction, AllowSelectFunction);
            var result = wind.ShowDialog();

            if (result != true)
            {
                return(null);
            }

            return(wind.SelectedItem);
        }