public void Parse(string[][] rows) { if (this.gridContext.HasRectangularSelection() == false) { throw new Exception("여러 범위"); } var hasHeader = this.ExistsHeader(rows.First()); var targetColumns = this.InitializeTargetColumns(rows.First()); var rowInfos = new List <DomainRowInfo>(); for (var i = hasHeader ? 1 : 0; i < rows.Length; i++) { var textFields = rows[i]; var rowInfo = new DomainRowInfo { Fields = this.Fill(targetColumns, textFields), TableName = CremaDataTable.GetTableName(this.tableName), }; rowInfos.Add(rowInfo); } this.DomainRows = rowInfos.ToArray(); }
public DomainTextClipboardPaster(DataGridContext gridContext) { this.gridContext = gridContext; this.columns = gridContext.GetSelectedColumns().ToArray(); this.items = gridContext.GetSelectedItems().ToArray(); if (gridContext.Items.SourceCollection is not ITypedList typedList) { var source = (gridContext.Items.SourceCollection as CollectionView).SourceCollection; typedList = source as ITypedList; } this.props = typedList.GetItemProperties(null); this.tableName = CremaDataTable.GetTableName(typedList.GetListName(null)); this.columnNames = CremaDataRowUtility.GetColumnNames(typedList); }
protected override void BeginEditCore() { try { this.IsBeginEnding = true; if (this.hasField == false) { try { base.BeginEditCore(); var gridContext = DataGridControl.GetDataGridContext(this); var typedList = gridContext.Items.SourceCollection as ITypedList; if (typedList == null) { var source = (gridContext.Items.SourceCollection as CollectionView).SourceCollection; typedList = source as ITypedList; } var props = typedList.GetItemProperties(null); this.tableName = CremaDataTable.GetTableName(typedList.GetListName(null)); this.columnNames = CremaDataRowUtility.GetColumnNames(typedList); this.defaultArray = new object[this.columnNames.Length]; this.itemArray = new object[this.columnNames.Length]; for (var i = 0; i < this.columnNames.Length; i++) { var prop = props[this.columnNames[i]]; if (prop.IsReadOnly == true) { continue; } var field = prop.GetValue(this.DataContext); if (field != DBNull.Value) { this.defaultArray[i] = field; this.itemArray[i] = field; } //if (gridContext.Columns[this.columnNames[i]] != null) //{ // this.fields.Add(this.columnNames[i], field); //} } // 컬럼 가상화 사용시 보이지 않는 셀은 생성이 안되기 때문에 // 아래 코드를 통해서 한번 쭉 돌려서 PrepareContainer 호출하게 하여 초기값을 설정하도록 했음. Release에서 동작함 //foreach (var item in this.Cells) //{ // var be = item.GetBindingExpression(Cell.ContentProperty); // be?.UpdateTarget(); //} base.CancelEditCore(); } finally { this.hasField = true; } } } finally { this.IsBeginEnding = false; } }