Hi,
I want to change the backcolor of alternate rows in multiband UltraGridControl. There is a property RowAlternateAppearance which can be use for this purpose. When is use this property, it works for all rows i.e. for parent as well as child rows. I want the color of all child rows same as color of its parent row. Is there any way to solve this problem? Please let me know.
ie. First row and its all child rows = Green color
Second row and its all child rows = White color
Third row and its all child rows = Green color
Forth row and its all child rows = White color and so on..
Thanks in advance,
Ujwal Salunkhe
Hi Ujwal,
ujwal_salunkhe said:I tried out as you said. In initializeRow event, HasChild() of the row which is initialized is alway returning false. I think that time it does not have any child row associated with it. I also observed that this event never raised when try to sort the rows. I think we need to find out another solution.
HasChild is really not a good thing to base this on, anyway. To determine if the row is a child row or not, you should use the band. Like e.Row.Band.Key or maybe e.Row.Band.Index.
If InitializeRow doesn't fire when you sort, then you can force it to fire manually. Use the AfterSortChange event and call grid.Rows.Refresh(FireInitializeRow). You may also need to do this when rows are added, removed, or filtered.
Hi Mike,
Thanks for the help.
I tried out as you said. In initializeRow event, HasChild() of the row which is initialized is alway returning false. I think that time it does not have any child row associated with it. I also observed that this event never raised when try to sort the rows. I think we need to find out another solution.
Is there any event through which we can decide the backcolor of the root row has changed or not?
Thanks,
This should be possible. What you would do is set the RowAlternateAppearance on the Override of the root-level band so that it only affects the root-level rows.
Then what you would do is handle the InitializeRow event and trap for rows in the child band. Now you can apply an Appearance to the child row based on it's parent row. So you need to determine if the parent row is an alternate row or not. So you can check the IsAlternate property on the row.