We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridControl - some general questions

Hi,

I have got some general questions regards to your GridControl.

1. Is there any way to obtain the current in view row and column index ranges by calling one function for once?

2. What should I do if I want to bring a line into view

3. When InvalidateCells is called, what does it do internally and which part of work is on the Dispatcher thread, which is not? The main reason why I am asking this question is because InvalidateCells is returned immediately after it is called then QueryCellInfo is fired. I feel there are gaps in between, which causes the command binding in the DataTemple which associated with the cells are not fired on user actions (e.g. a button binding to some ICommand in the DataTemplate, when the InvalidateCells are called frequently with very small intervals, the command sometimes is not fired when I click it)  

 


1 Reply

KP Kathirvel P Syncfusion Team August 2, 2012 07:46 AM UTC

Hi Xi Wang,
 
Thanks for using Syncfusion Products.
 
Regarding query 1:
 
You can get the visible rows and columns range from the grid by using the method GridControl.ScrollRows.GetVisibleLines(). This method will return visible line collections from grid. From this VisibleLinesCollection we can get the line index for the particular visible index.
 
Please refer the following snipped.
 
Code Snipped[C#]
 
// To get the visible rows and columns.
VisibleLinesCollection visibleRows = grid.ScrollRows.GetVisibleLines();
VisibleLinesCollection visibleColumns = grid.ScrollColumns.GetVisibleLines();
int top = visibleRows[visibleRows.FirstBodyVisibleIndex].LineIndex;
int left = visibleColumns[visibleColumns.FirstBodyVisibleIndex].LineIndex;
int bottom = visibleRows[visibleRows.LastBodyVisibleIndex].LineIndex;
int right = visibleColumns[visibleColumns.LastBodyVisibleIndex].LineIndex;
 
Regarding query 2:
 
You can achieve this requirement by using the GridControl.ScrollInView() method. This method will bring the specified row column index cell in to view.
 
Code Snipped[C#]
 
// To bring cell in to view.
RowColumnIndex rowColumnIndex = new RowColumnIndex(1,3);
grid.ScrollInView(rowColumnIndex);
 
Regarding query 3:
 
InvalidateCells marks the cells a dirty flag. If the invalidated cell is in view then it will trigger the QueryCellInfo while arranging the cells. In case the cells which are not in view is invalidated, the dirty flag is set to the particular cells, but the QueryCellInfo trigger when those cells brought to view.
 
Please let us know if this helps.
 
Regards,
Kathirvel

Loader.
Live Chat Icon For mobile
Up arrow icon