How can I be informed when the visible rows (cards) in a CardView changes? I have tried with AfterRowRegionScroll, but this is not raised when scrolling the cards.
I then would like to find the visible (and not visible) rows, in order to change a value depending on whether the cell is visible...
Thanks!
Actually, there is an event:
AfterCardsScroll(object sender, AfterCardsScrollEventArgs e)
I can then use
foreach (UltraGridRow row in grid.Rows) {
if (e.Rows.IsCardVisible(row))
{//do stuff}
}
...after some more testing, I can report that e.Rows.IsCardVisible actually only reports true for Cards that were visible, and not for Cards now visible. So it has the expected behaviour of BeforeCardsScroll rather than AfterCardsScroll, and is sadly useless for me.
Hi,
I tried this out and I get the same results. It looks like the IsCardVisible method is relying on the UIElements of the grid, and since the event fires before the grid has painted, it's not up-to-date.
You can get around this by forcing the grid to updated the UIElements before checking the IsCardVisible property.
This worked for me:
private void ultraGrid1_AfterCardsScroll(object sender, AfterCardsScrollEventArgs e) { UltraGrid grid = (UltraGrid)sender; grid.DisplayLayout.UIElement.DirtyChildElements(true); grid.Update(); Debug.WriteLine("************ ultraGrid1_AfterCardsScroll **************"); foreach (UltraGridRow row in e.Rows) { Debug.WriteLineIf(e.Rows.IsCardVisible(row), row.Cells[0].Text, e.Rows.IsCardVisible(row).ToString()); } }