I have a gridview with RowAutoHeight set to true. One column uses a MemoEdit to display text. So each row's height is set to fit it's content. Great feature, i like it.
But Im having a problem when there is more text then can fit within the grid's height. The row is sized properly but you cannot scroll down to see the bottom part which extends off grid. The vertical scroll bar only scrolls by record. Is there a way to get it to scroll by pixel or by content?
Or some workaround where the row will not grow larger then the grid, then if you click it you get a popup editor to display the full text?
How to scroll by content
Answers
Hi John,
I'm sorry, but the XtraGrid doesn't provide the capability of scrolling data content. The data in the XtraGrid is scrolled by rows. However, you can improve the current behavior by handling the gridView's CalcRowHeight event as shown below:
private void gridView1_CalcRowHeight(object sender, DevExpress.XtraGrid.Views.Grid.RowHeightEventArgs e) {
GridViewInfo vi = gridView1.GetViewInfo() as GridViewInfo;
Text = vi.ViewRects.Rows.ToString();
if (e.RowHeight > vi.ViewRects.Rows.Height - 10)
e.RowHeight = vi.ViewRects.Rows.Height - 10;
}
Please try this solution and inform us of your results.
Thanks,
Stan.
That works. It looks better and scrolling will seem correct for the users now. There is still a problem that the text/data is being truncated, but I solved this by adding a handler for the double click event. In this handler I open a simple form which will display the full text. So users can see all text for the record if they need to.
The really long records that don't fit on grid are semi-rare, so this should be ok solution for users.
thanks
Thank you for the feedback, John.
I am happy to hear that my assistance was helpful to you.
Please do not hesitate to contact us if you experience problems when using our products. We will be happy to help you at any time.
Thanks,
Stan.