public ElementoUpperPanel InitializeFilters() { // Popolo la grid DataGridView.DataSource = Negozio.Elementi.ToList(); //Creo il pannello _filterPanel = new ElementoUpperPanel(); _filterPanel.ComboCategoriaElemento.Items.Add(ALL_CATEGORIES); _filterPanel.ComboCategoriaElemento.Items.AddRange(Negozio.Categorie.ToArray()); _filterPanel.ComboCategoriaElemento.SelectedItem = _filterPanel.ComboCategoriaElemento.Items.OfType <string>().First(); _filterPanel.ComboStatoElemento.Items.Add(ALL_STATES); _filterPanel.ComboStatoElemento.Items.AddRange(Negozio.StatiElemento.ToArray()); _filterPanel.ComboStatoElemento.SelectedItem = _filterPanel.ComboStatoElemento.Items.OfType <string>().First(); _filterPanel.ComboTipoElemento.Items.Clear(); _filterPanel.ComboTipoElemento.Items.Add(ALL_TYPES); _filterPanel.ComboTipoElemento.SelectedItem = _filterPanel.ComboTipoElemento.Items.OfType <string>().First(); _filterPanel.ComboTipoElemento.Enabled = false; _filterPanel.ComboStatoElemento.SelectionChangeCommitted += RefreshStati; _filterPanel.ComboCategoriaElemento.SelectionChangeCommitted += RefreshCategoria; _filterPanel.ComboTipoElemento.SelectionChangeCommitted += RefreshTipo; return(_filterPanel); }
public FilterPresenter(DataGridView dataGridView) { if (dataGridView == null) { throw new ArgumentNullException("data grid view must be not null"); } _filterPanel = new ElementoUpperPanel(); _dataGridView = dataGridView; }