protected override void AssignColumns(DevExpress.XtraGrid.Views.Base.ColumnView cv, bool synchronize) { if (_gridListEditor == null) { base.AssignColumns(cv, synchronize); return; } if (synchronize) { base.AssignColumns(cv, true); } else { // if (!((IColumnViewEditor)_gridListEditor).OverrideViewDesignMode) { Columns.Clear(); ////var columnsListEditorModelSynchronizer = new ColumnsListEditorModelSynchronizer(_gridListEditor, _gridListEditor.Model); ////columnsListEditorModelSynchronizer.ApplyModel(); var gridColumns = _gridListEditor.GridView.Columns.OfType <IXafGridColumn>(); foreach (var column in gridColumns) { var xpandXafGridColumn = column.CreateNew(column.TypeInfo, _gridListEditor); xpandXafGridColumn.ApplyModel(column.Model); Columns.Add((GridColumn)xpandXafGridColumn); xpandXafGridColumn.Assign((GridColumn)column); } // } else { // base.AssignColumns(cv, false); // } } }
protected override void AssignColumns(DevExpress.XtraGrid.Views.Base.ColumnView cv, bool synchronize) { if (synchronize) { base.AssignColumns(cv, true); } else { Columns.Clear(); for (int n = 0; n < cv.Columns.Count; n++) { if (cv.Columns[n] is IXafGridColumn) { var cvColumn = (IXafGridColumn)cv.Columns[n]; Columns.Add((GridColumn)cvColumn.CreateNew(cvColumn.TypeInfo, cvColumn.Editor)); // Columns.Add(new XpandXafGridColumn(cvColumn.TypeInfo, cvColumn.Editor)); } else { Columns.Add(new GridColumn()); } } for (int n = 0; n < Columns.Count; n++) { var xpandXafGridColumn = Columns[n] as IXafGridColumn; if (xpandXafGridColumn != null) { (xpandXafGridColumn).Assign(cv.Columns[n]); } } } }
protected override void AssignColumns(DevExpress.XtraGrid.Views.Base.ColumnView cv, bool synchronize) { base.AssignColumns(cv, synchronize); if (!synchronize) { ((IModelSynchronizersHolder)this).AssignSynchronizers(cv); } }
IList GetSelectedObjects(DevExpress.XtraGrid.Views.Base.ColumnView focusedView) { int[] selectedRows = focusedView.GetSelectedRows(); if ((selectedRows != null) && (selectedRows.Length > 0)) { IEnumerable <object> objects = selectedRows.Where(rowHandle => rowHandle > -1).Select(focusedView.GetRow).Where(obj => obj != null); return(objects.ToList()); } return(new List <object>()); }
private IGridColumnModelSynchronizer GetColumnInfo(GridColumn column, DevExpress.XtraGrid.Views.Base.ColumnView view) { IGridColumnModelSynchronizer result = null; var holder = view as IModelSynchronizersHolder; if (holder != null) { result = holder.GetSynchronizer(column) as IGridColumnModelSynchronizer; } return(result); }
void IModelSynchronizersHolder.AssignSynchronizers(DevExpress.XtraGrid.Views.Base.ColumnView sourceView) { IModelSynchronizersHolder current = this; IModelSynchronizersHolder sourceInfoProvider = (IModelSynchronizersHolder)sourceView; for (int n = 0; n < sourceView.Columns.Count; n++) { IGridColumnModelSynchronizer info = sourceInfoProvider.GetSynchronizer(sourceView.Columns[n]) as IGridColumnModelSynchronizer; if (info != null) { current.RegisterSynchronizer(Columns[n], info); } } }
object GetFocusedRowObject(DevExpress.XtraGrid.Views.Base.ColumnView view) { if (((IMasterDetailColumnView)view).Window == null) { return(XtraGridUtils.GetFocusedRowObject(CollectionSource, view)); } int rowHandle = view.FocusedRowHandle; if (!((!view.IsDataRow(rowHandle) && !view.IsNewItemRow(rowHandle)))) { return(XtraGridUtils.GetFocusedRowObject(view)); } return(XtraGridUtils.GetFocusedRowObject(CollectionSource, view)); }
private void gridView1_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { string s = string.Empty; DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView; BindingSource dataSource = view.DataSource as BindingSource; if (dataSource == null) { s = "没有数据 QAQ"; } else if (dataSource.Count == 0) { s = "没有找到符合条件的数据 QAQ"; } Font font = new Font("微软雅黑", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5); e.Graphics.DrawString(s, font, Brushes.Black, r); }
private void UpdateRow(DevExpress.XtraGrid.Views.Base.ColumnView View) { // Obtain the Price column. DevExpress.XtraGrid.Columns.GridColumn col = View.Columns.ColumnByFieldName("Price"); if (col == null) { return; } View.BeginSort(); try { // Obtain the number of data rows. int dataRowCount = View.DataRowCount; // Traverse data rows and change the Price field values. for (int i = 0; i < dataRowCount; i++) { object cellValue = View.GetRowCellValue(i, col); double newValue = Convert.ToDouble(cellValue) * 0.9; View.SetRowCellValue(i, col, newValue); } } finally { View.EndSort(); } }
protected override void AssignColumns(DevExpress.XtraGrid.Views.Base.ColumnView cv, bool synchronize) { if (_gridListEditor == null) { base.AssignColumns(cv, synchronize); return; } if (synchronize) { base.AssignColumns(cv, true); } else { Columns.Clear(); var gridColumns = _gridListEditor.GridView.Columns.OfType <IXafGridColumn>(); foreach (var column in gridColumns) { var xpandXafGridColumn = column.CreateNew(column.TypeInfo, _gridListEditor); xpandXafGridColumn.ApplyModel(column.Model); Columns.Add((GridColumn)xpandXafGridColumn); xpandXafGridColumn.Assign((GridColumn)column); } } }
public XpandFilterBuilder(FilterColumnCollection columns, IDXMenuManager manager, UserLookAndFeel lookAndFeel, DevExpress.XtraGrid.Views.Base.ColumnView view, FilterColumn fColumn, IEnumerable <IModelMember> modelMembers) : base(columns, manager, lookAndFeel, view, fColumn) { _modelMembers = modelMembers; }
public static Form CreateFilterBuilderDialogEx(this DevExpress.XtraGrid.Views.Base.ColumnView columnView, FilterColumnCollection filterColumns, FilterColumn defaultFilterColumn, IEnumerable <IModelMember> modelMembers) { return(new XpandFilterBuilder(filterColumns, columnView.GridControl.MenuManager, columnView.GridControl.LookAndFeel, columnView, defaultFilterColumn, modelMembers)); }
DevExpress.XtraGrid.Views.Base.ColumnView GetFocusedGridView(DevExpress.XtraGrid.Views.Base.ColumnView view) { Frame masterFrame = ((IMasterDetailColumnView)view).MasterFrame; return(masterFrame?.View != null?GetFocusedGridView(masterFrame) : view); }