public ListViewFilter() { text.SetFocus(); text.SetCompletions(typeof(T).GetProperties().Select(p => p.Name).ToArray <string> ()); text.Activated += (sender, e) => Refresh(); PackStart(text); PackStart(filterList, true); }
protected SearchDialog(IController <T> controller) { Controller = controller; Title = Application.TranslationCatalog.GetString("Search"); search.SetFocus(); search.SetCompletions(typeof(T).GetPropertiesNames()); refresh.Clicked += delegate { search.Text = string.Empty; if (Controller != null) { Controller.Reload = true; } Refresh(); }; clearFilter.Clicked += (sender, e) => ResetFilter_Clicked(); search.Activated += delegate { search.BackgroundColor = search.Text == string.Empty ? Colors.White : Colors.LightGreen; Refresh(); }; search.Changed += delegate { search.BackgroundColor = Colors.White; if (search.Text == string.Empty) { Refresh(); } }; listView.RowActivated += delegate { var current = listView.SelectedRow; SelectedItem = store.GetValue(current, itemDataField); Respond(Command.Ok); }; actionBox.PackStart(refresh, true); actionBox.PackStart(clearFilter, true); var dialogoVBox = new VBox(); dialogoVBox.PackStart(new Label(Application.TranslationCatalog.GetString("Text search"))); dialogoVBox.PackStart(search); dialogoVBox.PackStart(filtersBox); dialogoVBox.PackStart(listView, true, true); dialogoVBox.PackStart(result); dialogoVBox.PackEnd(actionBox); Width = 700; Content = dialogoVBox; }