public ItemPicker() { ReadOnly = true; PlaceholderText = Application.TranslationCatalog.GetString("Click o press Intro or Space to select one item"); TooltipText = Application.TranslationCatalog.GetString("Click o press Intro or Space to select one item from the list"); var popoverBox = new VBox(); popoverBox.PackStart(listBoxFilter, true, true); popoverBox.PackEnd(selectedItemClear, false, true); var popover = new Popover { Content = popoverBox, }; Activated += delegate { if (!DisabledPicker) { popover.Show(Popover.Position.Top, this); listBoxFilter.Search.SetFocus(); } }; ButtonPressed += delegate { if (!DisabledPicker) { popover.Show(Popover.Position.Top, this); listBoxFilter.Search.SetFocus(); } }; listBoxFilter.ListBox.RowActivated += delegate { if (listBoxFilter.SelectedItem != null) { popover.Hide(); SelectedItem = listBoxFilter.SelectedItem; } }; selectedItemClear.Clicked += delegate { listBoxFilter.UnselectAll(); popover.Hide(); SelectedItem = default(T); }; }
public void UnselectAll() { listBoxFilter.UnselectAll(); }