Hi,
We are making use of alternating appearance in our wingrid. This is turned on through our style file.
So what we gather is this alternate item appearance takes effect across each band, If say, I have 2 bands, the child band also shows the alternate row appearance effect.
What we want to achieve is child rows should have the same appearance as parent row. Right now, we copy all the appearance properties of parent row and set on the child row when row is initialized. The child band is programatically made not to have the alternate row appearance. Is there a cleaner way to achieve this? Is there an easier way for a row in a child band have the same appearance as the parent row.
Thanks
Hello Duncan,
You are handling the situation correctly. The appearance should be set row by row in InitializeRow(). The advice I have is to not create new Appearance objects on each InitializeRow(); if you create an Appearance to use for each case of row and then set the row's Appearance to the appropriate one, this should improve your Grid's performance.
Please look to Formatting and Appearance based Performance Improvement for similar tips on improving your UltraGrid's performance.
Thanks for the reply.
I forgot to mention this. I need the original row appearance sans the selected or active row appearance. How can I get that?
Hello John,
The style library name and style resource name really helped. We did the following:
If .HasParent Then
If HasData(.ParentRow.Appearance.StyleLibraryName) Then .Appearance.StyleLibraryName = .ParentRow.Appearance.StyleLibraryName .Appearance.StyleResourceName = .ParentRow.Appearance.StyleResourceName Else .Appearance.StyleLibraryName ="GRIDROWSTYLE"
If .ParentRow.IsAlternate Then .Appearance.StyleResourceName = "ALTERNATEROW" Else .Appearance.StyleResourceName = "NORMALROW" End If End If End If
It is working. Thank you so much for the assistance.
Duncan,
If you are using style files, the route you probably want to go is to use the Row.Appearance.StyleResourceName property of the row in question. This will allow you to define a separate style resource in your .isl and specify specific rows who honor that appearance.
For more info on StyleResourceName's use, take a look at these forum posts:
http://es.infragistics.com/community/forums/p/38483/220953.aspx#220953
http://es.infragistics.com/community/forums/p/104799/495574.aspx#495574
Please let me know if I can further assist you.
Thank you very much for the tip. Let me try to explain the problem below.
Here is a small snippet containing what we are trying to achieve. This is being done inside on InitializeRow event of the grid.
with e.row
If .HasParent Then Dim bWasActive As Boolean = False Dim cellActive As UltraGridCell = ActiveCell Dim bWasEditing As Boolean = (cellActive?.IsInEditMode).GetValueOrDefault() Dim bWasSelected As Boolean = .ParentRow.Selected
If .ParentRow.IsActiveRow Then ActiveRow = Nothing bWasActive = True End If
.ParentRow.Selected = False .ParentRow.ResolveAppearance(oAppData, AppearancePropFlags.BackColor) .Appearance.BackColor = oAppData.BackColor
If bWasActive Then ActiveRow = .ParentRow End If
ActiveCell = cellActive
If bWasEditing Then PerformAction(UltraGridAction.EnterEditMode) End If
.ParentRow.Selected = bWasSelected End If
End With
One thing I will like to mention here is we use themes and have a style file for each theme. Doing the above causes issues because see how we set active row to nothing. If there is an active object binding for a grid, then making active row nothing and again back to something creates issues. Similarly putting cell back to edit mode is not always working. It puts the cell to active mode but user sometimes cannot edit it. So above way does not appear to be a decent way to achieve what we need.
So if I am using style files, when will be a good time in code to create these appearance objects. Unless initializeRow fires, user does not know if it is going to normal row or alternate row. Hope this clarifies our issue more.
You cannot programmatically get that appearance. It sounds like you are trying to use the row's parent appearance to set the row's appearance, and you are defending against the case that the parent is active. A simpler approach would be to create your Appearance objects you need and set each row's Appearance to the correct global Appearance you've created, based on that row's position.
Please let me know if I can assist you further.