//public void AddButtonColumnImplementation(IGnosisButtonColumnImplementation buttonColumnImplementation) //{ // this.Columns.Add((GnosisButtonColumnWPF)buttonColumnImplementation); //} //public void AddCheckColumnImplementation(IGnosisCheckColumnImplementation checkColumnImplementation) //{ // this.Columns.Add((GnosisCheckColumnWPF)checkColumnImplementation); //} //public void AddComboColumnImplementation(IGnosisComboColumnImplementation comboColumnImplementation) //{ // this.Columns.Add((GnosisComboColumnWPF)comboColumnImplementation); //} //public void AddDateTimeColumnImplementation(IGnosisDateTimeColumnImplementation dateTimeColumnImplementation) //{ // this.Columns.Add((GnosisDateTimeColumnWPF)dateTimeColumnImplementation); //} //public void AddJoinColumnImplementation(IGnosisJoinColumnImplementation joinColumnImplementation) //{ // this.Columns.Add((GnosisJoinColumnWPF)joinColumnImplementation); //} public void LoadCell(IGnosisGridFieldImplementation gridField, int column, int row, int colSpan, int rowSpan, bool alternateRowColour) { //while (gridContent.RowDefinitions.Count() < row + rowSpan) //{ // RowDefinition rowdef = new RowDefinition(); // rowdef.Height = new GridLength(controller.StyleManager.GetFieldHeight(), GridUnitType.Pixel); // gridContent.RowDefinitions.Add(rowdef); //} FrameworkElement gridFieldWPF = (FrameworkElement)gridField; //apply grid lines gridFieldWPF.Margin = new Thickness(0, 0, gridLineThickness, gridLineThickness); //if (alternateRowColour) //{ // txtWPF.Background = (Brush)Application.Current.FindResource("LightPrimary"); //} Grid.SetColumn(gridFieldWPF, column); Grid.SetColumnSpan(gridFieldWPF, colSpan); Grid.SetRow(gridFieldWPF, row); Grid.SetRowSpan(gridFieldWPF, rowSpan); gridContent.Children.Add(gridFieldWPF); }
public override IGnosisGridFieldImplementation GetFieldClone() { IGnosisGridFieldImplementation gridField = base.GetFieldClone(); gridField.Locked = true; return(gridField); }
public virtual void AddCell(IGnosisGridFieldImplementation gridFieldImp) { gridFieldImp.IsEvenRow = isEvenRow; // gridFieldImp.SetGotFocusHandler(new Action(OnGotFocus)); // gridFieldImp.SetLostFocusHandler(new Action(OnLostFocus)); Fields.Add(gridFieldImp); gridFieldImp.PropertyChanged += GridFieldImp_PropertyChanged; }
private static void AssignGridFieldProperties(IGnosisGridFieldImplementation gridField, GnosisGridColumn column) { gridField.ID = GlobalData.Singleton.GetNewControlID(); gridField.Order = column.Order; gridField.ControlType = ControlTypeMapping.GetControlTypeName(gridField.GetType()); gridField.Tooltip = column.Tooltip; gridField.ContentHorizontalAlignment = column.ContentHorizontalAlignment; gridField.ContentVerticalAlignment = column.ContentVerticalAlignment; gridField.MinDisplayChars = column.MinDisplayChars; gridField.MaxDisplayChars = column.MaxDisplayChars; gridField.Hidden = column.Hidden; gridField.ReadOnly = column.ReadOnly; gridField.Dataset = column.Dataset; gridField.DatasetItem = column.DatasetItem; gridField.IsEvenRow = column.IsEvenRow; gridField.Value = column.Value; }
protected void SetDisplayWidths() { fieldClone = GetFieldClone(); font = instanceController.EntityController.GetNormalStyle().Font; fontSize = instanceController.EntityController.GetNormalStyle().FontSize; characterWidth = GlobalData.Singleton.StyleHelper.GetCharacterWidth(fieldClone, font, fontSize); fieldHeight = GlobalData.Singleton.StyleHelper.GetFieldHeight(fieldClone, font, fontSize); //display chars if (MinDisplayChars == 0) { if (this.Dataset == null || this.DatasetItem == null) { GlobalData.Singleton.ErrorHandler.HandleError("Dataset or DatasetItem not defined for " + columnModel.GnosisName + " " + ControlTypeMapping.GetControlTypeName(this.GetType()), "GnosisGridColumnController"); } else { MinDisplayChars = instanceController.EntityController.GetMinDisplayChars(Dataset, DatasetItem); } } if (MaxDisplayChars == 0) { if (MaxChars > 0) { MaxDisplayChars = MaxChars; } else { MaxDisplayChars = instanceController.EntityController.GetMaxDisplayChars(Dataset, DatasetItem); } } //max field width //if (columnModel is GnosisTextColumn && ((GnosisTextColumn)columnModel).MaxTextDisplayWidthChars > 0) //{ // //MaxFieldWidth = styles.GetMaxFieldWidth(((GnosisTextColumn)columnModel).MaxDisplayWidthChars); // MaxFieldWidth = GlobalData.Singleton.StyleHelper.GetMaxFieldWidth(gridField, font, fontSize, ((GnosisTextColumn)columnModel).MaxDisplayChars); //} //else if (MaxDisplayChars > 0) //{ // //MaxFieldWidth = styles.GetMaxFieldWidth(MaxDisplayChars); // MaxFieldWidth = GlobalData.Singleton.StyleHelper.GetMaxFieldWidth(gridField, font, fontSize, MaxDisplayChars); //} //else if (MaxChars > 0) //{ // //MaxFieldWidth = styles.GetMaxFieldWidth(MaxChars); // MaxFieldWidth = GlobalData.Singleton.StyleHelper.GetMaxFieldWidth(gridField, font, fontSize, MaxChars); //} ////min field width //if (columnModel is GnosisTextColumn && ((GnosisTextColumn)columnModel).MinTextDisplayWidthChars > 0) //{ // MinFieldWidth = GlobalData.Singleton.StyleHelper.GetMinFieldWidth(gridField, font, fontSize, ((GnosisTextColumn)columnModel).MinTextDisplayWidthChars); //} //else if (columnModel is GnosisTextResults && ((GnosisTextResults)columnModel).MinTextDisplayWidthChars > 0) //{ // MinFieldWidth = GlobalData.Singleton.StyleHelper.GetMinFieldWidth(gridField, font, fontSize, ((GnosisTextResults)columnModel).MinTextDisplayWidthChars); //} //else if (MinDisplayChars > 0) //{ // //MinFieldWidth = styles.GetMinFieldWidth(MinDisplayChars); // MinFieldWidth = GlobalData.Singleton.StyleHelper.GetMinFieldWidth(gridField, font, fontSize, MinDisplayChars); //} //else if (MaxChars > 0) //{ // // MinFieldWidth = styles.GetMinFieldWidth(MaxChars); // MinFieldWidth = GlobalData.Singleton.StyleHelper.GetMinFieldWidth(gridField, font, fontSize, MaxChars); //} //if (MinFieldWidth > MaxFieldWidth) //{ // MinFieldWidth = MaxFieldWidth; //} //else if (MaxFieldWidth < MinFieldWidth) //{ // MaxFieldWidth = MinFieldWidth; //} if (columnModel._ContentHorizontalAlignment == GnosisController.HorizontalAlignmentType.NONE) { GnosisController.HorizontalAlignmentType ha = instanceController.EntityController.GetContentHorizontalAlignment(Dataset, DatasetItem); columnModel._ContentHorizontalAlignment = ha; header._ContentHorizontalAlignment = ha; } if (fieldClone is GnosisGridTextField || fieldClone is GnosisResultsTextField) { TextHeight = GlobalData.Singleton.StyleHelper.GetTextHeight( (GnosisGridTextField)fieldClone, instanceController.EntityController.GetNormalStyle().Font, instanceController.EntityController.GetNormalStyle().FontSize); //PaddingVertical = (int)(fieldHeight - TextHeight) / 2; } }
//public virtual IGnosisGridFieldImplementation GetFieldClone() //{ // IGnosisGridFieldImplementation gridFieldImp = fieldController.GetClone(); // gridFieldImp.Order = columnModel.Order; // fields.Add(gridFieldImp); // return gridFieldImp; //} public virtual IGnosisGridFieldImplementation GetFieldClone() { IGnosisGridFieldImplementation gridField = null; if (ColumnModel is GnosisTextColumn) { gridField = GnosisControlCreator.CreateGnosisGridTextField((GnosisTextColumn)ColumnModel); } else if (ColumnModel is GnosisCheckColumn) { gridField = GnosisControlCreator.CreateGnosisGridCheckField((GnosisCheckColumn)ColumnModel); } else if (ColumnModel is GnosisDateColumn) { gridField = GnosisControlCreator.CreateGnosisGridDateField((GnosisDateColumn)ColumnModel); } else if (ColumnModel is GnosisDateTimeColumn) { gridField = GnosisControlCreator.CreateGnosisGridDateTimeField((GnosisDateTimeColumn)ColumnModel); } else if (ColumnModel is GnosisComboColumn) { gridField = GnosisControlCreator.CreateGnosisGridComboField((GnosisComboColumn)ColumnModel); } else if (ColumnModel is GnosisLinkColumn) { gridField = GnosisControlCreator.CreateGnosisGridLinkField((GnosisLinkColumn)ColumnModel); } else if (ColumnModel is GnosisNumberColumn) { gridField = GnosisControlCreator.CreateGnosisGridNumberField((GnosisNumberColumn)ColumnModel); } else if (ColumnModel is GnosisTextResults) { gridField = GnosisControlCreator.CreateGnosisResultsTextField((GnosisTextResults)ColumnModel); } else if (ColumnModel is GnosisCheckResults) { gridField = GnosisControlCreator.CreateGnosisResultsCheckField((GnosisCheckResults)ColumnModel); } else if (ColumnModel is GnosisDateResults) { gridField = GnosisControlCreator.CreateGnosisResultsDateField((GnosisDateResults)ColumnModel); } else if (ColumnModel is GnosisDateTimeResults) { gridField = GnosisControlCreator.CreateGnosisResultsDateTimeField((GnosisDateTimeResults)ColumnModel); } else if (ColumnModel is GnosisNumberResults) { gridField = GnosisControlCreator.CreateGnosisResultsNumberField((GnosisNumberResults)ColumnModel); } if (gridField != null) { GlobalData.Singleton.StyleHelper.ApplyStyle(gridField, instanceController.EntityController.GetNormalStyle()); return(gridField); } else { GlobalData.Singleton.ErrorHandler.HandleError("Unknown column type: " + ColumnModel.GetType().ToString(), "GnosisGridColumnController.GetFieldClone"); return(null); } }