public ControlTreeDataGrid(IDataEntryDataService dataService , ApplicationSettings appSettings , FormDataEntryLogic dataEntryController) : this() { DataService = dataService; DataEntryController = dataEntryController; AppSettings = appSettings; DataGridTableStyle tableStyle = dataService.InitializeTreeColumns(this); _speciesColumn = tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn; _sgColumn = tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn; _stratumColumn = tableStyle.GridColumnStyles["Stratum"] as EditableComboBoxColumn; _treeNumberColumn = tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn; _initialsColoumn = tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn; _logsColumn = tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn; _kpiColumn = tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn; _errorsColumn = tableStyle.GridColumnStyles["Errors"] as DataGridTextBoxColumn; Settings_CruisersChanged(null, null);//initialize initials column if (_logsColumn != null) { _logsColumn.Click += this.LogsClicked; LogColumnVisable = DataService.EnableLogGrading; } if (_stratumColumn != null) { _stratumColumn.DataSource = dataService.TreeStrata; } }
protected override void OnCellValueChanged(EditableDataGridCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= _BS_trees.Count) { return; } base.OnCellValueChanged(e); Tree tree = _BS_trees[e.RowIndex] as Tree; if (tree == null) { return; } if (e.Column == _sgColumn) { tree.HandleSampleGroupChanged(); this.UpdateSpeciesColumn(tree); //this.DataEntryController.HandleSampleGroupChanged(this, tree); } else if (e.Column == _speciesColumn) { EditableComboBoxColumn col = e.Column as EditableComboBoxColumn; if (col == null) { return; } tree.HandleSpeciesChanged(col.EditComboBox.SelectedItem as TreeDefaultValueDO); } else if (e.Column == _stratumColumn) { tree.HandleStratumChanged(); this.UpdateSampleGroupColumn(tree); this.UpdateSpeciesColumn(tree); //this.DataEntryController.HandleStratumChanged(this, tree); } }
public LayoutPlot(IDataEntryDataService dataService , ISampleSelectorRepository sampleSelectorRepository , ApplicationSettings appSettings , ISoundService soundService , IViewController viewController , PlotStratum stratum) : this() { SampleSelectorRepository = sampleSelectorRepository; DataService = dataService; AppSettings = appSettings; this.ViewLogicController = new LayoutPlotLogic(stratum, this, dataService, soundService, DialogService.Instance, AppSettings, viewController, sampleSelectorRepository); //Setup DataGrid _tableStyle = stratum.InitializeTreeColumns(_dataGrid); _speciesColumn = _tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn; _sgColumn = _tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn; _treeNumberColumn = _tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn; _initialsColoumn = _tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn; _logsColumn = _tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn; _kpiColumn = _tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn; _errorsColumn = _tableStyle.GridColumnStyles["Error"] as DataGridTextBoxColumn; if (_logsColumn != null) { _logsColumn.Click += this.LogsClicked; LogColumnVisable = DataService.EnableLogGrading; } Settings_CruisersChanged(null, null);//initialize initials column InitializeTallyPanel(); this.ViewLogicController.UpdateCurrentPlot(); }
public Form1() { InitializeComponent(); // tell our form that we want to intercept all key press events in our form.Otherwise our KeyPress event method will only get events when the form class has focus. //this.KeyPreview = true; //give our dataGrid our SIP, so that I can listen and react to events on our SIP editableDataGrid1.SIP = inputPanel1; editableDataGrid1.CellValidating += new EditableDataGridCellValidatingEventHandler(editableDataGrid1_CellValidating); editableDataGrid1.CellValueChanged += new EditableDataGridCellValueChangedEventHandler(editableDataGrid1_CellValueChanged); buttonPanel1.Text = "something"; ////allow new rows on datagrid //editableDataGrid1.AllowNewRow = true; //set up columns for our dataGrid DataGridTableStyle ts = new DataGridTableStyle() { MappingName = "something" }; comboBoxCol = new EditableComboBoxColumn() { MappingName = "num1" }; textBoxCol = new EditableTextBoxColumn() { MappingName = "word", MaxTextLength = 12, GoToNextColumnWhenTextCompleate = true }; dateTimeCol = new EditableDateTimePickerColumn() { MappingName = "date" }; upDwnCol = new EditableUpDownColumn() { MappingName = "upDwn" }; readOnlyTextBoxCol = new EditableTextBoxColumn() { MappingName = "word2", ReadOnly = true }; ts.GridColumnStyles.Add(comboBoxCol); ts.GridColumnStyles.Add(textBoxCol); ts.GridColumnStyles.Add(dateTimeCol); ts.GridColumnStyles.Add(upDwnCol); ts.GridColumnStyles.Add(readOnlyTextBoxCol); //set up our button column and give it a event handler for button clicks //note the mapping name for the buttonColumn must be provided and a valid property to bind to //this is because the dataGrid only displays columns that have a valid MappingName //I've created a work around that should work for Full Framework, and will probably be able to make a workaround for Mobile //, but until then provide a mapping name. //For DAL DataObjects you could use the Tag property as a mapping name, since it isn't reserved for any propuse, and is intended for special cases like this. DataGridButtonColumn buttonCol = new DataGridButtonColumn() { MappingName = "button", UseCellColumnTextForCellValue = true, Text = "click me" }; buttonCol.Click += new ButtonCellClickEventHandler(buttonCol_Click); ts.GridColumnStyles.Add(buttonCol); editableDataGrid1.TableStyles.Add(ts); //create some dummy data to test the grid List <something> things = new List <something>(); for (int i = 0; i < 100; i++) { things.Add(new something() { num1 = i, word = "word", button = "click me" }); } bindingSource1.DataSource = things; //editableDataGrid1.DataSource = things; }