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.
Unfortunately, activation email could not send to your email. Please try again.

Increase height of a particular row.

Thread ID:

Created:

Updated:

Platform:

Replies:

118746 Apr 7,2015 02:18 AM Apr 10,2015 09:53 PM WinRT 5
loading
Tags: SfDataGrid
Avdesh Chaudhary
Asked On April 7, 2015 02:18 AM

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 

Muthukumar Kalyanasundaram [Syncfusion]
Replied On April 7, 2015 12:43 PM

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


Avdesh Chaudhary
Replied On April 8, 2015 12:28 AM

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

Muthukumar Kalyanasundaram [Syncfusion]
Replied On April 9, 2015 02:14 PM

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

Avdesh Chaudhary
Replied On April 10, 2015 01:09 AM

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

Sivakumar R [Syncfusion]
Replied On April 10, 2015 09:53 PM

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


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.

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.

;