Ticket CQ18285
Visible to All Users

How to scroll by content

created 18 years ago

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?

Answers

created 18 years ago

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.

    Comments (2)

      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

      Stan (DevExpress Support) 18 years ago

        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.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.