Hi,
I'm trying to convert the code I have in Initialize_Row handler for cells formatting using the "new"(for me) OperatorCondition.
I've done something like this:
Dim GestitaNonCondition As New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, 0)
Dim AppearanceNonGestita As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
Dim GestitaCondition As New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, 1)
Dim AppearanceGestita As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
AppearanceGestita.FontData.Bold = Infragistics.Win.DefaultableBoolean.False
Dim ValAppearanceGestita As New Infragistics.Win.ConditionValueAppearance()
ValAppearanceGestita.Add(GestitaNonCondition, AppearanceNonGestita)
ValAppearanceGestita.Add(GestitaCondition, AppearanceGestita)
Me.Grid.DisplayLayout.Bands(0).Columns("Gestita").ValueBasedAppearance = ValAppearanceGestita
Where "Gestita" is a flag that can be 0 or 1.
When I load the grid all works well.Sometimes, in my application, Column "Gestita" change its value (due to a refresh event coming from a server) but its appearance remains the same.
Can anybody help me ?
May I ask why you are changing the code?
Using the InitializeRow event it no more or less efficient than using a ValueBasedAppearance, but it's a lot less code.
ValueBasedAppearances are great if you need to set up your appearances at design-time, but setting them up at run-time is actually a lot more work than just using InitializeRow.
Anyway... if the cell appearance is not refreshing, then my guess is that either your data source is not notifying the grid of the change, or else this is a bug in the grid.
So what kind of data source are you using?
And what version of the grid are you using? Do you have the latest service release? How to get the latest service release - Infragistics Community
Hi Mike,
I'm using WinGrid version 9.2, bounded on DataSet.
My first goal is make a performance tuning for InitializeRow funcion, can be that the right way ?
In my application, binding 30.000 rows with my current InitializeRow take about 8seconds, I tried to comment InitializeRow and it takes about 3 seconds.
can you help me to do that ? Probabily i make some big mistakes...
I already read your great WinGrid Performance Guide, and make some change according with that.
Thanks a lot
The Performance guide covers the majority of cases. But if you want to post your InitializeRow code here, I'll be happy to take a quick look at it and see if I notice any obvious problems.
this is my InitializeRow, I’m sorry I know this method is very convoluted.. hope you can help me..
Private Sub Grid_InitializeRow(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles Grid.InitializeRow
Try
Grid.BeginUpdate()
Grid.EventManager.AllEventsEnabled = False
If [Global].MainLayout IsNot Nothing Then
If [Global].MainLayout.IsGrigliaFontBold = False Then
If e.Row.GetCellValue("Gestita") = True Then
e.Row.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.False
Else
e.Row.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True
End If
If [Global].Operatore.AbilitaLockFonie AndAlso e.Row.GetCellValue("Locked") Then
e.Row.Cells("Progressivo").Appearance.Image = imgLocked
e.Row.Cells("Progressivo").Appearance.Image = imgGrid(e.Row.GetCellValue("Tipo"))
Dim in_registrazione As Boolean = 0
If Not (Convert.IsDBNull(e.Row.GetCellValue("InRegistrazioneRX"))) Then
in_registrazione = e.Row.GetCellValue("InRegistrazioneRX")
If Not (Convert.IsDBNull(e.Row.GetCellValue("InRegistrazioneTX"))) Then
in_registrazione = in_registrazione Or e.Row.GetCellValue("InRegistrazioneTX")
If in_registrazione Then
e.Row.Cells("Progressivo").Appearance.Image = imgInRegistrazione 'MANUEL 31-07-2007
End If 'MANUEL 31-07-2007
'Manuel: si colora la linea con il colore dell'importanza, se attivato da configurazione client.
If ([Global].Config.ColoraLineaComeImportanza = True) Then
If (e.Row.GetCellValue("Importanza") = 1) Then
e.Row.Appearance.BackColor = System.Drawing.Color.Yellow
ElseIf (e.Row.GetCellValue("Importanza") = 2) Then
e.Row.Appearance.BackColor = System.Drawing.Color.Red
e.Row.Appearance.BackColor = System.Drawing.Color.Empty
Dim ChiamanteColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn = e.Row.Band.Columns("Chiamante")
Dim ChiamatoColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn = e.Row.Band.Columns("Chiamato")
Dim NominativoUtilizzatoreColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn = e.Row.Band.Columns("NominativoUtilizzatore")
Dim IntestatarioColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn = e.Row.Band.Columns("Intestatario")
If (e.Row.GetCellValue("Verso") IsNot Nothing) AndAlso (e.Row.GetCellValue("Verso") IsNot DBNull.Value) Then
If (e.Row.GetCellValue("Verso") = InterfacceOmniLogServer.enmVersi.verso_uscente) Then
If (e.Row.Cells("Chiamato").Appearance.Image Is Nothing) AndAlso (e.Row.GetCellValue("Chiamato") IsNot DBNull.Value) AndAlso (e.Row.GetCellText(ChiamatoColumn).Trim <> String.Empty) Then
e.Row.Cells("Chiamato").Appearance.Image = imgGrid(11)
ElseIf (e.Row.GetCellValue("Verso") = InterfacceOmniLogServer.enmVersi.verso_entrante) Then
If (e.Row.Cells("Chiamante").Appearance.Image Is Nothing) AndAlso (e.Row.GetCellValue("Chiamante") IsNot DBNull.Value) AndAlso (e.Row.GetCellText(ChiamanteColumn).Trim <> String.Empty) Then
e.Row.Cells("Chiamante").Appearance.Image = imgGrid(11)
If (e.Row.Cells("NominativoUtilizzatore").Appearance.Image Is Nothing) AndAlso (e.Row.GetCellValue("NominativoUtilizzatore") IsNot DBNull.Value) AndAlso (e.Row.GetCellText(NominativoUtilizzatoreColumn).Trim <> String.Empty) Then
e.Row.Cells("NominativoUtilizzatore").Appearance.Image = imgGrid(11)
If (e.Row.Cells("Intestatario").Appearance.Image Is Nothing) AndAlso (e.Row.GetCellValue("Intestatario") IsNot DBNull.Value) AndAlso (e.Row.GetCellText(IntestatarioColumn).Trim <> String.Empty) Then
e.Row.Cells("Intestatario").Appearance.Image = imgGrid(11)
Catch ex As Exception
Logging.Logger.Error("InitializeRow", ex)
End Try
If (e.Row.GetCellValue("DurataRx") IsNot DBNull.Value) Then
If e.Row.Cells.Exists("DurataRxFormattata") Then
e.Row.Cells("DurataRxFormattata").Value = TimeSpan.FromSeconds(e.Row.GetCellValue("DurataRx")).ToString
If Not (e.Row.GetCellValue("CodiceColore") Is DBNull.Value) Then
If e.Row.GetCellValue("CodiceColore") <> TRASPARENT_COLOR Then
If Config.UtilizzaColoriGestioneContatti Then
e.Row.Appearance.BackColor = System.Drawing.Color.FromArgb(e.Row.GetCellValue("CodiceColore"))
e.Row.Cells("CodiceColore").Appearance.BackColor = System.Drawing.Color.FromArgb(e.Row.GetCellValue("CodiceColore"))
If f_RowAdded Then
f_RowAdded = False
e.Row.RefreshSortPosition()
e.Row.Refresh()
Finally
Grid.EventManager.AllEventsEnabled = True
Grid.EndUpdate()
End Sub
Thanks Mike, I'll take my time to read your post and apply your suggestions then i'll let you know.