protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem) { SampleDataRow row = (SampleDataRow)dataItem; FrameworkElement frameworkElement = base.GenerateElement(cell, dataItem); this.SetAutomationID((FrameworkElement)cell, row); cell.DataContext = (object)row.GetCell(this.SampleDataProperty); cell.KeyDown += new KeyEventHandler(this.cell_KeyDown); return(frameworkElement); }
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem) { this.editingRow = (SampleDataRow)dataItem; object obj = this.editingRow.GetCell(this.sampleDataProperty).Value; FrameworkElement element = (FrameworkElement)null; if (this.sampleDataProperty.SampleTypeConfiguration.SampleType == SampleBasicType.Boolean) { element = this.GenerateElement(cell, dataItem); } if (this.sampleDataProperty.SampleTypeConfiguration.SampleType == SampleBasicType.Image) { this.BrowseForNewImage(); element = this.GenerateElement(cell, dataItem); } if (this.sampleDataProperty.SampleTypeConfiguration.SampleType == SampleBasicType.Number || this.sampleDataProperty.SampleTypeConfiguration.SampleType == SampleBasicType.String) { element = this.GenerateTextEditor(obj.ToString()); } this.SetAutomationID(element, this.editingRow); return(element); }
private void SetAutomationID(FrameworkElement element, SampleDataRow row) { string str = (row.RowNumber + 1).ToString((IFormatProvider)NumberFormatInfo.InvariantInfo); AutomationElement.SetId((DependencyObject)element, "Cell_" + this.Name + "_" + str); }
public SampleDataCellValue(SampleDataRow row, SampleDataProperty property) { this.Row = row; this.Property = property; }