Hi..
This error happens when we have a conditional formatting code and then you try to load a new layout. The error is "Exception thrown by the target of invocation". The workaround is to use the initialize grid row event instead of conditional formatting. Any ideas?
InitializeLayout event code: (Red color for numbers less than 0)
Infragistics.Win.Appearance appearanceRed = new Infragistics.Win.Appearance();
valAppearanceLessThen0.Add(conditionLessThen0, appearanceRed);
column.ValueBasedAppearance = valAppearanceLessThen0;
Load layout code on click of a button:
grdPnLGrid.DisplayLayout.LoadFromXml(LayoutFilenameTrades);
Hello,
Could you please try to attach if possible a small sample project reproducing the above mentioned issue, I will be happy to take a look at it.
We are having an issue that seems very much the same except we get a NullReferenceException
Infragistics.Win.SupportDialogs.dll!Infragistics.Win.SupportDialogs.ConditionalFormatting.ConditionManager.StyleAppearancesManager.get() + 0xca bytes Infragistics.Win.SupportDialogs.dll!Infragistics.Win.SupportDialogs.ConditionalFormatting.ConditionRowControl.ConditionRowControl(Infragistics.Win.SupportDialogs.ConditionalFormatting.ConditionManager conditionManager, bool isEditingControl) + 0x23d bytes
The grid layout is loaded from XML after which we open the conditional formatting dialog. Our version is 11.2.20112.2098 (everything worked fine in 11.1)
If you find a solution to this, please post it here.
The workaround (which is not performance efficient) that I am using is in the Initializerow event, I am checking the cell value and providing different appearance.
I'm pretty sure that this bug has been fixed in the latest hotfix. If it still occurs after downloading said hotfix, you should contact Developer Support.
-Matt
I'm having the exact same issue here using v8.1 of the WinGrid. Basically, display layouts cannot be loaded to the grid when I use conditional formatting on the columns. I get the "Exception has been thrown by the target of an invocation." exception.
Sample code (with oColumn being a column in the grid and ultraGrid1 being my grid):
ConditionValueAppearanceForm conditionValueAppearanceForm = new ConditionValueAppearanceForm( oColumn );DialogResult result = conditionValueAppearanceForm.ShowDialog( this );if ( result == DialogResult.OK ){ // If the user clicked OK, set the ConditionValueAppearance on the column. oColumn.ValueBasedAppearance = conditionValueAppearanceForm.ConditionValueAppearance; ultraGrid1.DisplayLayout.SaveAsXml( "layout.xml" ); ultraGrid1.DisplayLayout.LoadFromXml( "layout.xml" ); // This throws the exception}
If anyone has any ideas here, it would be greatly appreciated. I created an incident report already. I'm expecting my users to create their own simple or complex profiles, so I need the intended behavior. I have it so that a user could filter Column A and then set up formatting so that when Column B has a value greater than 0, Column A would show up with a background color of red. I can save that layout fine. But, I need the grid to have that view the next time he/she opens the application, and that's where the exception occurs every time. The exception goes away if I remove the conditional formatting from the column.