Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1075
Exception while scrolling right
posted

I have grid with column chooser at left. When I try to scroll to the right at the end of the grid I receive a memory error. Also scrollbar is in the middle position when the last column shows. How to fix this?

I use the following code for Initializing Layout:

private void gridViewWaste_InitializeLayout(object sender, InitializeLayoutEventArgs e)

{

if ((configfileName != null) && (!configfileName.Equals("")))

try

{

this.gridViewWaste.DisplayLayout.LoadFromXml(configfileName);

SetFilterLabel();

}

catch (Exception)//don't show exception if we were not able to load

{

MessageBox.Show("Config file is not correct. Applying default settings", "VWA View Waste Config");

}

// disable key fields for editing

e.Layout.Bands["Weights"].Columns["ID"].CellActivation = Activation.Disabled;

e.Layout.Bands["Weights"].Columns["TransKey"].CellActivation = Activation.Disabled;

e.Layout.Bands["Weights"].Columns["WasteCost"].CellActivation = Activation.Disabled;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["Weight"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.Double;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["WasteCost"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.CurrencyNonNegative;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["FoodTypeCost"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.CurrencyNonNegative;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["ContainerWeight"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.Double;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["ContainerCost"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.CurrencyNonNegative;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["NItems"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.IntegerPositiveWithSpin;

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["NProduced"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.IntegerNonNegativeWithSpin;

// Hide the irrelevant columns

//e.Layout.Bands["Transfers"].Columns["TransKey"].Hidden = true;

// Resize the columns that we are interested in

e.Layout.Bands["Weights"].Columns["Timestamp"].Width = 150;

e.Layout.Bands["Weights"].Columns["IsPreconsumer"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["PreconsumerNames"];

e.Layout.Bands["Weights"].Columns["FoodTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["FoodNames"];

e.Layout.Bands["Weights"].Columns["LossTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["LossNames"];

e.Layout.Bands["Weights"].Columns["ContainerTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["ContainerNames"];

e.Layout.Bands["Weights"].Columns["StationTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["StationNames"];

e.Layout.Bands["Weights"].Columns["DispositionTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["DispositionNames"];

e.Layout.Bands["Weights"].Columns["DaypartTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["DaypartNames"];

e.Layout.Bands["Weights"].Columns["BEOTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["BEONames"];

e.Layout.Bands["Weights"].Columns["UserTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["UserNames"];

e.Layout.Bands["Weights"].Columns["UOMID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["UOMNames"];

this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["FoodTypeID"].Style =

Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;

// Make the style of these two columns Edit so that the value list dropdown arrow

// doesn't appear, since we are displaying a custom edit control rather than use the

// ValueList

//e.Layout.Bands["Transfers"].Columns["FoodTypeID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Edit;

// We don't want to see the time portion of the date in the

// date columns, and we don't want to see the date portion

// in the time columns, so let's use the column's Format property

// to filter out the portions of the DateTime object that we don't want

e.Layout.Bands["Weights"].Columns["Timestamp"].Format = "MM/dd/yyyy hh:mm:ss";

// init colum headers

e.Layout.Bands["Weights"].Columns["TransKey"].Header.Caption = "Transfer Key";

e.Layout.Bands["Weights"].Columns["WasteCost"].Header.Caption = "Waste Cost";

e.Layout.Bands["Weights"].Columns["FoodTypeID"].Header.Caption = "Food Type";

e.Layout.Bands["Weights"].Columns["FoodTypeCost"].Header.Caption = "Food Type Cost";

e.Layout.Bands["Weights"].Columns["LossTypeID"].Header.Caption = "Loss Type";

e.Layout.Bands["Weights"].Columns["ContainerTypeID"].Header.Caption = "Container Type";

e.Layout.Bands["Weights"].Columns["ContainerWeight"].Header.Caption = "Container Weight";

e.Layout.Bands["Weights"].Columns["ContainerCost"].Header.Caption = "Container Cost";

e.Layout.Bands["Weights"].Columns["FoodTypeCost"].Header.Caption = "Food Type Cost";

e.Layout.Bands["Weights"].Columns["StationTypeID"].Header.Caption = "Station Type";

e.Layout.Bands["Weights"].Columns["DispositionTypeID"].Header.Caption = "Disposition Type";

e.Layout.Bands["Weights"].Columns["DaypartTypeID"].Header.Caption = "DayPart Type";

e.Layout.Bands["Weights"].Columns["BEOTypeID"].Header.Caption = "Event Order Type";

e.Layout.Bands["Weights"].Columns["UserTypeID"].Header.Caption = "User Type";

e.Layout.Bands["Weights"].Columns["UserQuestion"].Header.Caption = "User Question";

e.Layout.Bands["Weights"].Columns["NItems"].Header.Caption = "Number of Items";

e.Layout.Bands["Weights"].Columns["NProduced"].Header.Caption = "Number of Produced Items";

e.Layout.Bands["Weights"].Columns["UOMID"].Header.Caption = "Unit of Mesure";

// You can control the appearance of the separator using the SpecialRowSeparatorAppearance

// property.

e.Layout.Override.SpecialRowSeparatorAppearance.BackColor = Color.FromArgb(233, 242, 199);

e.Layout.Override.RowAppearance.BackColorAlpha = Infragistics.Win.Alpha.Transparent;

// use the same appearance for alternate rows

e.Layout.Override.RowAlternateAppearance = e.Layout.Override.RowAppearance;

e.Layout.Override.CellAppearance.BackColorAlpha = Infragistics.Win.
Alpha.UseAlphaLevel;

e.Layout.Override.CellAppearance.AlphaLevel = 150;

e.Layout.Override.HeaderAppearance.AlphaLevel = 150;

e.Layout.Override.HeaderAppearance.BackColorAlpha = Infragistics.Win.
Alpha.UseAlphaLevel;

// FILTER ROW FUNCTIONALITY RELATED ULTRAGRID SETTINGS

// ----------------------------------------------------------------------------------

// Enable the the filter row user interface by setting the FilterUIType to FilterRow.

e.Layout.Override.FilterUIType = FilterUIType.FilterRow;

// FilterEvaluationTrigger specifies when UltraGrid applies the filter criteria typed

// into a filter row. Default is OnCellValueChange which will cause the UltraGrid to

// re-filter the data as soon as the user modifies the value of a filter cell.

e.Layout.Override.FilterEvaluationTrigger = FilterEvaluationTrigger.OnCellValueChange;

// By default the UltraGrid selects the type of the filter operand editor based on

// the column's DataType. For DateTime and boolean columns it uses the column's editors.

// For other column types it uses the Combo. You can explicitly specify the operand

// editor style by setting the FilterOperandStyle on the override or the individual

// columns.

//e.Layout.Override.FilterOperandStyle = FilterOperandStyle.Combo;

// By default UltraGrid displays user interface for selecting the filter operator.

// You can set the FilterOperatorLocation to hide this user interface. This

// property is available on column as well so it can be controlled on a per column

// basis. Default is WithOperand. This property is exposed off the column as well.

e.Layout.Override.FilterOperatorLocation = FilterOperatorLocation.WithOperand;

// By default the UltraGrid uses StartsWith as the filter operator. You use

// the FilterOperatorDefaultValue property to specify a different filter operator

// to use. This is the default or the initial filter operator value of the cells

// in filter row. If filter operator user interface is enabled (FilterOperatorLocation

// is not set to None) then that ui will be initialized to the value of this

// property. The user can then change the operator as he/she chooses via the operator

// drop down.

e.Layout.Override.FilterOperatorDefaultValue = FilterOperatorDefaultValue.Equals;

// FilterOperatorDropDownItems property can be used to control the options provided

// to the user for selecting the filter operator. By default UltraGrid bases

// what operator options to provide on the column's data type. This property is

// avaibale on the column as well.

e.Layout.Override.FilterOperatorDropDownItems = FilterOperatorDropDownItems.Default;

// By default UltraGrid displays a clear button in each cell of the filter row

// as well as in the row selector of the filter row. When the user clicks this

// button the associated filter criteria is cleared. You can use the

// FilterClearButtonLocation property to control if and where the filter clear

// buttons are displayed.

e.Layout.Override.FilterClearButtonLocation = FilterClearButtonLocation.RowAndCell;

// Appearance of the filter row can be controlled using the FilterRowAppearance proeprty.

e.Layout.Override.FilterRowAppearance.BackColor = Color.LightYellow;

// You can use the FilterRowPrompt to display a prompt in the filter row. By default

// UltraGrid does not display any prompt in the filter row.

e.Layout.Override.FilterRowPrompt = "Click here to filter data...";

// You can use the FilterRowPromptAppearance to change the appearance of the prompt.

// By default the prompt is transparent and uses the same fore color as the filter row.

// You can make it non-transparent by setting the appearance' BackColorAlpha property

// or by setting the BackColor to a desired value.

e.Layout.Override.FilterRowPromptAppearance.BackColorAlpha = Alpha.Opaque;

// for smart datetime filters

e.Layout.Bands["Weights"].Columns["Timestamp"].FilterOperandStyle = FilterOperandStyle.DropDownList;

e.Layout.Bands["Weights"].Columns["Timestamp"].FilterOperatorLocation = FilterOperatorLocation.Hidden;

// By default the prompt is spread across multiple cells if it's bigger than the

// first cell. You can confine the prompt to a particular cell by setting the

// SpecialRowPromptField property off the band to the key of a column.

//e.Layout.Bands["Weights"].SpecialRowPromptField = e.Layout.Bands["Weights"].Columns[0].Key;

// Display a separator between the filter row other rows. SpecialRowSeparator property

// can be used to display separators between various 'special' rows, including for the

// filter row. This property is a flagged enum property so it can take multiple values.

e.Layout.Override.SpecialRowSeparator = SpecialRowSeparator.FilterRow;

// ----------------------------------------------------------------------------------

//e.Layout.Override.AllowAddNew = AllowAddNew.FixedAddRowOnBottom;

e.Layout.Override.AllowDelete = DefaultableBoolean.True;

e.Layout.Override.AllowUpdate = DefaultableBoolean.True;

// sorting properties

e.Layout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;

// display cell text on multiple lines

e.Layout.Override.RowSizing = RowSizing.AutoFree;

e.Layout.Override.CellMultiLine = DefaultableBoolean.True;

// turn row selectors on for band 0

e.Layout.Bands["Weights"].Override.RowSelectors = DefaultableBoolean.True;

// init transfer's bands if used

if (e.Layout.Bands[0].Key.Equals("Transfers"))

{

e.Layout.Bands[
"Transfers"].Columns["TransKey"].CellActivation = Activation.Disabled;

//value editors

Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit editor = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit();

editor.EditAs = Infragistics.Win.UltraWinMaskedEdit.EditAsType.UseSpecifiedMask;

editor.InputMask = @"4\.nn\.nn";

editor.DataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;

editor.ClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;

editor.DisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;

e.Layout.Bands["Transfers"].Columns["TrackerSWVersion"].EditorControl = editor;

// Set the mask modes. This only effects columns that use EditorWithMask or derived editors.

e.Layout.Bands["Transfers"].Columns["TrackerSWVersion"].MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth;

e.Layout.Bands["Transfers"].Columns["Timestamp"].Width = 150;

e.Layout.Bands["Transfers"].Columns["Timestamp"].Format = "MM/dd/yyyy hh:mm:ss";

// The FoodTypeID and LossTypeID

// columns should display the name, not the ID.

// We can use a ValueList to accomplish this

e.Layout.Bands["Transfers"].Columns["TermID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["TermNames"];

e.Layout.Bands["Transfers"].Columns["SiteID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["SiteNames"];

e.Layout.Bands["Transfers"].Columns["TypeCatalogID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["TypeCatalogNames"];

e.Layout.Bands["Transfers"].Override.RowSelectors = DefaultableBoolean.True;

// for smart datetime filters

e.Layout.Bands["Transfers"].Columns["Timestamp"].FilterOperandStyle = FilterOperandStyle.DropDownList;e.Layout.Bands["Transfers"].Columns["Timestamp"].FilterOperatorLocation = FilterOperatorLocation.Hidden;

}

}

Parents
No Data
Reply
  • 1075
    posted

     By commenting different lines in InitializeLayout method I found out that the problem was caused by following line:

    e.Layout.Override.CellAppearance.AlphaLevel = 150;

    When I commented this line RED CROSS disappeared and now my application scrolling correctly to the right.

Children