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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Need to resize RowHeader column in grid when line number greater than 2 digits

Thread ID:

Created:

Updated:

Platform:

Replies:

142104 Jan 18,2019 09:09 PM UTC Jan 21,2019 03:07 PM UTC WPF 2
loading
Tags: GridDataControl
Steve McWilliams
Asked On January 18, 2019 09:09 PM UTC

I have a grid that has a RowHeader containing the line number which works fine, except when the line numbers get to 100 and above, they are truncated and the column cannot be manually resized.

I found 2-3 older threads on this forum about this issue, with various suggestions, none of which have worked for me so far.
Hopefully you can look into my attached examples and help me out.

The 'tuningGrid' is the grid with the problem.
There is a ResizeRowHeader() method which is trying to set the column resizing options; maybe it is in the wrong place.
I also have tried adding a tuningGrid_Loaded method where I set tuningGrid.Model.ColumnsWidths[0] = 300, but that crashes because ColumnWidths is empty at that point.

Attachment: RowHeader_4f17e17f.zip

Arulraj A [Syncfusion]
Replied On January 21, 2019 10:36 AM UTC

 
Thanks for contacting Syncfusion support. 
 
To achieve your requirement “How to resize the row header based on the line numbers shown” using ResizeColumnsToFit method with GridResizeToFitOptions.NoShrinkSize as like the following code snippet 
 
void dataGrid_Loaded(object sender, RoutedEventArgs e) 
{ 
     this.dataGrid.Model.Grid.ScrollRows.Changed += ScrollRows_Changed; 
} 
 
 
private void ScrollRows_Changed(object sender, EventArgs e) 
{ 
     int lastrow = dataGrid.Model.Grid.ScrollRows.LastBodyVisibleLineIndex; 
     dataGrid.Model.ResizeColumnsToFit(GridRangeInfo.Cell(lastrow, 0), GridResizeToFitOptions.NoShrinkSize); 
} 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Arulraj A 


Steve McWilliams
Replied On January 21, 2019 03:07 PM UTC

Thanks. That works now.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;