static SubSession() { MyFlagProperty = DataPropertyDescriptor <bool> .Register("MyFlag", typeof(SubSession)); DoSubActionOperation = OperationDescriptor.Register("DoSubAction", typeof(SubSession)); DoOtherSubActionOperation = OperationDescriptor.Register("DoOtherSubAction", typeof(SubSession)); OnStaticConstruction(); }
public void SetPropertyDescriptor(DataSchema dataSchema, DataPropertyDescriptor propertyDescriptor) { DataSchema = dataSchema; PropertyDescriptor = propertyDescriptor; PopulateCombo(comboOperation1, FilterOperations.OP_HAS_ANY_VALUE.DisplayName, dataSchema, propertyDescriptor.PropertyType); PopulateCombo(comboOperation2, Resources.QuickFilterForm_SetPropertyDescriptor_No_other_filter, dataSchema, propertyDescriptor.PropertyType); Text = string.Format(Resources.QuickFilterForm_SetPropertyDescriptor_Show_rows_where__0____, propertyDescriptor.DisplayName); }
public static ColumnRef FromPropertyDescriptor(DataPropertyDescriptor dataPropertyDescriptor) { if (dataPropertyDescriptor is ColumnPropertyDescriptor columnPropertyDescriptor) { return(new ColumnRef(columnPropertyDescriptor.PropertyPath)); } return(new ColumnRef(new ColumnId(dataPropertyDescriptor.ColumnCaption))); }
public Color?GetColumnColor(DataPropertyDescriptor propertyDescriptor) { if (_columnColors.TryGetValue(propertyDescriptor.Name, out Color color)) { return(color); } return(null); }
public Color?GetColor(DataPropertyDescriptor propertyDescriptor, RowItem rowItem) { if (!_colorManagers.TryGetValue(propertyDescriptor.Name, out ColorManager colorManager)) { return(null); } return(colorManager.ColorScheme.GetColor(colorManager.GetRowValue(rowItem, propertyDescriptor))); }
protected virtual void boundDataGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) { DataPropertyDescriptor propertyDescriptor = null; if (e.ColumnIndex >= 0) { var column = boundDataGridView.Columns[e.ColumnIndex]; propertyDescriptor = GetPropertyDescriptor(column); } e.ContextMenuStrip = contextMenuStrip; _columnFilterPropertyDescriptor = propertyDescriptor; UpdateContextMenuItems(); }
public Predicate <object> GetPredicate(DataSchema dataSchema, DataPropertyDescriptor propertyDescriptor) { var columnFilters = GetColumnFilters(propertyDescriptor).ToArray(); if (columnFilters.Length == 0) { return(null); } var predicates = columnFilters .Select(filter => filter.Predicate.MakePredicate(dataSchema, propertyDescriptor.PropertyType)) .ToArray(); return(value => predicates.All(predicate => predicate(value))); }
static MainSession() { SampleFlagProperty = DataPropertyDescriptor <bool> .Register("SampleFlag", typeof(MainSession)); IsLoggedInProperty = DataPropertyDescriptor <bool> .Register("IsLoggedIn", typeof(MainSession)); SubSessionProperty = SessionPropertyDescriptor <SubSession> .Register("SubSession", typeof(MainSession)); LoginSessionProperty = SessionPropertyDescriptor <LoginSession> .Register("LoginSession", typeof(MainSession)); DoActionOperation = OperationDescriptor.Register("DoAction", typeof(MainSession)); DoOtherActionOperation = OperationDescriptor.Register("DoOtherAction", typeof(MainSession)); LogOutOperation = OperationDescriptor.Register("LogOut", typeof(MainSession)); OnStaticConstruction(); }
public object GetRowValue(RowItem rowItem, DataPropertyDescriptor propertyDescriptor) { if (Transform == null) { return(propertyDescriptor.GetValue(rowItem)); } var pdIndex = PropertyDescriptors.IndexOf(propertyDescriptor); if (pdIndex < 0) { return(null); } return(GetRowValues(rowItem).Skip(pdIndex).FirstOrDefault()); }
public void SetFilter(DataSchema dataSchema, DataPropertyDescriptor propertyDescriptor, RowFilter rowFilter) { RowFilter = rowFilter; SetPropertyDescriptor(dataSchema, propertyDescriptor); var columnFilters = rowFilter.GetColumnFilters(propertyDescriptor).ToArray(); if (columnFilters.Length >= 1) { SetFilterOperation(comboOperation1, tbxOperand1, columnFilters[0]); tbxOperand1.Text = columnFilters[0].Predicate.GetOperandDisplayText(dataSchema, propertyDescriptor.PropertyType); } if (columnFilters.Length >= 2) { SetFilterOperation(comboOperation2, tbxOperand2, columnFilters[1]); } }
static LoginSession() { UserNameProperty = DataPropertyDescriptor <string> .Register("UserName", typeof(LoginSession)); PasswordProperty = DataPropertyDescriptor <string> .Register("Password", typeof(LoginSession)); NewUserNameProperty = DataPropertyDescriptor <string> .Register("NewUserName", typeof(LoginSession)); NewPassword1Property = DataPropertyDescriptor <string> .Register("NewPassword1", typeof(LoginSession)); NewPassword2Property = DataPropertyDescriptor <string> .Register("NewPassword2", typeof(LoginSession)); LoginOperation = OperationDescriptor.Register("Login", typeof(LoginSession)); RegisterOperation = OperationDescriptor.Register("Register", typeof(LoginSession)); OnStaticConstruction(); }
protected void UpdateColumnFormats(bool restoreDefaultFormats) { var bindingListSource = DataSource as BindingListSource; if (bindingListSource == null) { return; } var newColumnFormats = ImmutableList.ValueOf(_itemProperties.Select(prop => bindingListSource.ColumnFormats.GetFormat(new ColumnId(prop.ColumnCaption)))); if (Equals(newColumnFormats, _columnFormats)) { return; } _columnFormats = newColumnFormats; foreach (var column in Columns.OfType <DataGridViewColumn>()) { if (string.IsNullOrEmpty(column.DataPropertyName)) { continue; } DataPropertyDescriptor pd = null; ColumnFormat columnFormat = null; if (column.Index < _itemProperties.Count && _itemProperties[column.Index].Name == column.DataPropertyName) { pd = _itemProperties[column.Index]; columnFormat = _columnFormats[column.Index]; } else { for (int i = 0; i < _itemProperties.Count; i++) { if (_itemProperties[i].Name == column.DataPropertyName) { pd = _itemProperties[i]; columnFormat = _columnFormats[i]; } } } if (pd == null) { continue; } if (null != columnFormat.Format) { column.DefaultCellStyle.Format = columnFormat.Format; } else { if (restoreDefaultFormats) { var originalColumn = _viewContext.CreateGridViewColumn(pd); column.DefaultCellStyle.Format = originalColumn.DefaultCellStyle.Format; } } if (columnFormat.Width.HasValue) { column.Width = columnFormat.Width.Value; } } }
public ClusterRole.Transform GetRowTransform(DataPropertyDescriptor propertyDescriptor) { _rowTransforms.TryGetValue(propertyDescriptor.Name, out ClusterRole.Transform role); return(role); }
static MyApplicationSession() { SampleFlagProperty = DataPropertyDescriptor <bool> .Register("SampleFlag", typeof(MyApplicationSession)); OnStaticConstruction(); }
private CaptionedValues GetRowHeaderLevel(IList <RowItem> rowItems, DataPropertyDescriptor dataPropertyDescriptor) { return(new CaptionedValues(dataPropertyDescriptor.ColumnCaption, dataPropertyDescriptor.PropertyType, rowItems.Select(dataPropertyDescriptor.GetValue))); }
public IEnumerable <ColumnFilter> GetColumnFilters(DataPropertyDescriptor propertyDescriptor) { var columnId = ColumnId.GetColumnId(propertyDescriptor); return(ColumnFilters.Where(columnFilter => Equals(columnId, columnFilter.ColumnId))); }
public void QuickFilter(DataGridViewColumn column) { _columnFilterPropertyDescriptor = BindingListSource.FindDataProperty(column.DataPropertyName); filterToolStripMenuItem_Click(filterToolStripMenuItem, new EventArgs()); }
public void ShowFormatDialog(DataGridViewColumn column) { _columnFilterPropertyDescriptor = BindingListSource.FindDataProperty(column.DataPropertyName); formatToolStripMenuItem_Click(formatToolStripMenuItem, new EventArgs()); }
public static ColumnId GetColumnId(DataPropertyDescriptor dataPropertyDescriptor) { return(new ColumnId(dataPropertyDescriptor.ColumnCaption.GetCaption(DataSchemaLocalizer.INVARIANT))); }
static MyGeneratedClass() { SampleFlagProperty = DataPropertyDescriptor <bool> .Register("SampleFlag", typeof(MyGeneratedClass)); OnStaticConstruction(); }