private void SelectionChanged() { _selectedItem = MethodParametersGrid.SelectedRows.Count == 0 ? null : (Parameter)MethodParametersGrid.SelectedRows[0].DataBoundItem; MoveUpButton.Enabled = _selectedItem != null && MethodParametersGrid.SelectedRows[0].Index != 0; MoveDownButton.Enabled = _selectedItem != null && MethodParametersGrid.SelectedRows[0].Index != Parameters.Count - 1; }
public void InitializeParameterGrid() { MethodParametersGrid.AutoGenerateColumns = false; MethodParametersGrid.Columns.Clear(); MethodParametersGrid.DataSource = Parameters; MethodParametersGrid.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender; MethodParametersGrid.MultiSelect = false; MethodParametersGrid.AllowUserToResizeRows = false; MethodParametersGrid.AllowDrop = true; MethodParametersGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; var column = new DataGridViewTextBoxColumn { Name = "Parameter", DataPropertyName = "FullDeclaration", HeaderText = RubberduckUI.Parameter, ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill }; MethodParametersGrid.Columns.Add(column); _selectedItem = Parameters[0]; }