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

Grid title changes with horizontal scroll

Hi,

I'm right now facing an issue related to the title display for a given grid file.

This scenario can be easily reporoduced using the customerOrders.grid file , the steps are shown below,

- Open CustomerOrders.grid
- After the grid file is loaded scroll the contents horizontally to the left.
- Now the initial titile "Customer : 91 items" gets trimmed depending on the intensity of the scroll.

Attached is the screenshots which has both before and after scroll scenarios mentioned above

Solution required.

- Is there any way to keep the grid title (Customers : 91 items) stationary without getting trimmed even if the user makes a horizontal scroll to view the grid contents

Awaiting for a positive reply for this solution at the earliest.




afterscroll_5430bf3a.rar

1 Reply

JJ Jisha Joy Syncfusion Team May 12, 2010 10:35 AM UTC

Hi Lim,

Thank you for using Syncfusion products.

You could avaoid the issue by handling the TableControlDrawCell and TableControl.HScrollPixelPosChanged events. See the code:


private void TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;

if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
&& e.Inner.ColIndex == 0 )
{
e.Inner.Cancel = true;
string s = e.Inner.Style.Text;
e.Inner.Style.Text = string.Empty;

Rectangle rect = e.Inner.Bounds;
rect.Location = new Point(0, rect.Y);

e.Inner.Renderer.Draw(e.Inner.Graphics, e.Inner.Bounds, e.Inner.RowIndex, e.Inner.ColIndex, e.Inner.Style);
e.Inner.Graphics.DrawString(s, e.Inner.Style.GdipFont, new SolidBrush(e.Inner.Style.TextColor), rect);

e.Inner.Style.Text = s;
}
}

private void HScrollPixelPosChanged(object sender, GridScrollPositionChangedEventArgs e)
{
GridTableControl tc = sender as GridTableControl;
tc.RefreshRange(GridRangeInfo.Row(1));
}


Sample for your reference:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGCScrolling-1116423455.zip

Please let me know if this helps.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon