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

Increase height of a particular row.

Hi,

I am using sfDataGrid and my requirement is to have a TextBox in TemplateColumn EditCell. This is to allow user to have new lines added. This is the column to add Comments, so user can press enter between texts.
To achieve this I am handling KeyDown event and based on that i want to increase the height of that particular row and the complete text will be visible to user.

I am able to increase height of all rows, but that is not required behaviour.

Can you please help me in achieving this feature.

Thanks 

5 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team April 7, 2015 04:43 PM UTC

Hi Avdesh,

Thank you for your interest in Syncfusion products.

We have analyzed your query. We have created simple sample based on your requirement. When large text in collection is loaded to the grid and columns have defined TextWrapping with wrap the content is wrapped with the default row height. The row height can grow automatically with the text length by handling QueryRowHeight event. The QueryRowHeight event is called again for that row alone and it resizes the row based on the edited content. The row to be resized with text that you have typed after editing in the cell, you can use CurrentCellEndEdit event and it will reset the row height internally. Please refer the attached sample and link,
Sample: http://www.syncfusion.com/downloads/support/forum/118746/SfDataGrid_RowHeight-663259469.zip

Link:
http://help.syncfusion.com/ug/wpf/index.html#!Documents/autorowheight.htm
http://help.syncfusion.com/ug/wpf/index.html#!Documents/howtherowheightcanautogrowwiththetextlength.htm

Please let us know if you have any concerns.

Regards,
Muthukumar K



AC Avdesh Chaudhary April 8, 2015 04:28 AM UTC

Hi,

The sample which you have attached is for a WPF application and I am using winrt sfDataGrid. So I should have got the WinRT sample.
Second thing is that you haven't read the problem statement I mention
"
I am using sfDataGrid and my requirement is to have a TextBox in TemplateColumn EditCell. This is to allow user to have new lines added. This is the column to add Comments, so user can press enter between texts.
To achieve this I am handling KeyDown event and based on that i want to increase the height of that particular row and the complete text will be visible to user.

I am able to increase height of all rows, but that is not required behavior.
"

I have mentioned that I need to have new lines added between the texts, means user can press enter and still keep on typing. But if I use "syncfusion:GridTextColumn" than on press Enter, it loses focus.
So can you help me in achieving the behavior I need to implement.

I need to have feature like "AcceptsReturn".

Thanks


MK Muthukumar Kalyanasundaram Syncfusion Team April 9, 2015 06:14 PM UTC

Hi Avdesh,

Please ignore the previous update where we have provided sample for WPF. Please find the details regarding your requirement in WinRT.

In WinRT, it is not possible to listen Key events of TextBox loaded inside Grid, in Grid level as WinRT doesn't support Preview events. So it is not possible to change the height of the row based on the content you are typing. But it is possible to set height of row in on-demand mode by handling SfDataGrid.QueryRowHeight event.

Refer the below documentation for more information.
http://help.syncfusion.com/UG/winrt/index.html#!Documents/autorowheight.htm
http://help.syncfusion.com/UG/winrt/index.html#!Documents/howcantherowheightautogrowwithtextlength.htm

Please let us know if you have any questions.

Thanks,
Muthukumar K


AC Avdesh Chaudhary April 10, 2015 05:09 AM UTC

Hi,

Thanks for your reply. 
Please validate the following scenario:

Can we access the collection of rows of sfDataGrid and based on row index in this collection, can we increase height of the row?
If this possible, please share the code or links for the same.
Thanks


SR Sivakumar R Syncfusion Team April 11, 2015 01:53 AM UTC

Hi Avdesh,

You can access the collection of rows in SfDataGrid through VisualContainer and you can set the Height for individual rows also as in the below code snippet.

using Syncfusion.UI.Xaml.Grid.Helpers;

this.grid.Loaded += grid_Loaded;

void grid_Loaded(object sender, RoutedEventArgs e)

{

var visualContainer = grid.GetVisualContainer();

var rowcount = visualContainer.RowHeights.LineCount;

// specific row height

visualContainer.RowHeights[3] = 70;

visualContainer.InvalidateMeasure();

}

Note: This is not recommended way. While sorting and grouping these settings will reset. If the above way meets your requirement you can use this.

Please let us know if you have any questions.

Thanks,

Sivakumar


Loader.
Live Chat Icon For mobile
Up arrow icon