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.

data grid row height change per the text

Thread ID:

Created:

Updated:

Platform:

Replies:

132259 Aug 23,2017 06:30 AM Nov 13,2017 10:58 PM Xamarin.Forms 12
loading
Tags: SfDataGrid
Barak Rozenfeld
Asked On August 23, 2017 06:30 AM

Hi all,

I created a simple datagrid which get the data from a web service works great.
however,
I want the row to to be changed per the text inside the row 

Thanks, 
Best Regards
Barak Rozenfeld

Ashok N [Syncfusion]
Replied On August 24, 2017 02:08 AM

Hi Barak, 
 
Thanks for contacting Syncfusion support. 
 
You can be achieved AutoRowHeight  by handling SfDatagrid.QueryRowHeight event and SfDatagrid.GetRowHeight method. SfDatagrid.QueryRowHeight event returns the row height on demand and SfDatagrid.GetRowHeight method returns the height of the row based on the content. Please refer the below code example  
 
//Hooks QueryRowHeight event in SfDataGrid to set the row height on demand 
dataGrid.QueryRowHeight += DataGrid_QueryRowHeight; 
 
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    if (e.RowIndex != 0) 
    { 
        //Calculates and sets the height of the row based on its content. 
        e.Height = dataGrid.GetRowHeight(e.RowIndex); 
        e.Handled = true; 
    } 
} 
 
Please refer the below UG link to get more details about AutoRowHeight 
 
 
Regards, 
Ashok 


CT CHANG
Replied On November 4, 2017 12:02 PM

Hi Barak, 
 
Thanks for contacting Syncfusion support. 
 
You can be achieved AutoRowHeight  by handling SfDatagrid.QueryRowHeight event and SfDatagrid.GetRowHeight method. SfDatagrid.QueryRowHeight event returns the row height on demand and SfDatagrid.GetRowHeight method returns the height of the row based on the content. Please refer the below code example  
 
//Hooks QueryRowHeight event in SfDataGrid to set the row height on demand 
dataGrid.QueryRowHeight += DataGrid_QueryRowHeight; 
 
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    if (e.RowIndex != 0) 
    { 
        //Calculates and sets the height of the row based on its content. 
        e.Height = dataGrid.GetRowHeight(e.RowIndex); 
        e.Handled = true; 
    } 
} 
 
Please refer the below UG link to get more details about AutoRowHeight 
 
 
Regards, 
Ashok 


Hi Ashok,

I encounter runtime exception each time I call GetRowHeight() method, and I using GridTemplateColumn in my XAML. Do you have any idea why it crashed when call GetRowHeight()?

SfDataGrid version 15.3.0.33.

Error Message:

    Object reference not set to an instance of an object.

StackTrace:

at Syncfusion.SfDataGrid.XForms.Droid.MeasureSize.Convert (Xamarin.Forms.View view, Xamarin.Forms.VisualElement valid) [0x0002c] in <605b15f75385441483a1ceab754f747d>:0

at Syncfusion.SfDataGrid.XForms.Droid.MeasureSize.CalculateHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid grid, Syncfusion.SfDataGrid.XForms.GridColumn column, Xamarin.Forms.View view) [0x0000a] in <605b15f75385441483a1ceab754f747d>:0

at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetTemplateHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid grid, Syncfusion.SfDataGrid.XForms.GridColumn column, System.Object rowData, System.Int32 rowIndex) [0x00060] in <fe30172fa3ba4837bfbe14fa0c90fdf2>:0 

at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetRowHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid datagrid, System.Object rowData, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.GridRowSizingOptions options) [0x0012e] in <fe30172fa3ba4837bfbe14fa0c90fdf2>:0 

at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetRowHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid dataGrid, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.GridRowSizingOptions options) [0x000c6] in <fe30172fa3ba4837bfbe14fa0c90fdf2>:0 


Regards,

CT


Ashok N [Syncfusion]
Replied On November 6, 2017 05:04 AM

Hi Chiew, 
 
Thanks for contacting Syncfuion support. 
 
We have checked your query and prepared the SfDataGrid sample with GridTemplateColumn and set the RowHeight by handling QueryRowHeight event in SfDataGrid v15.3.0.33 and Xamarin.Forms v2.3.3.180 but we are not able to reproduced the issue, SfDataGrid loaded properly and RowHeight has been calculated based on the GridCell value. For your reference we have attached sample and Screenshot in the below location, please check it. Could you please share your SfDataGrid and Xamarin.Forms version details, SfDataGrid.Columns creation code snippet, tested device details? Otherwise please do revert us by modifying our sample to replicate the issue or share your sample along with replication procedure, that would be more helpful for us to proceed further.   
     
 
 
Regards, 
Ashok 


CT CHANG
Replied On November 6, 2017 10:06 PM

Hi Ashok,


Thanks you for the sample code and I will have a look and compare it with my code.


Cheers,

CT


CT CHANG
Replied On November 6, 2017 11:21 PM

Hi Chiew, 
 
Thanks for contacting Syncfuion support. 
 
We have checked your query and prepared the SfDataGrid sample with GridTemplateColumn and set the RowHeight by handling QueryRowHeight event in SfDataGrid v15.3.0.33 and Xamarin.Forms v2.3.3.180 but we are not able to reproduced the issue, SfDataGrid loaded properly and RowHeight has been calculated based on the GridCell value. For your reference we have attached sample and Screenshot in the below location, please check it. Could you please share your SfDataGrid and Xamarin.Forms version details, SfDataGrid.Columns creation code snippet, tested device details? Otherwise please do revert us by modifying our sample to replicate the issue or share your sample along with replication procedure, that would be more helpful for us to proceed further.   
     
 
 
Regards, 
Ashok 


Hi Ashok,

I manage to locked down the root cause of the problem.

If I compile your sample code with Mono Framework 5.4.1.6, and upgrade the Xamarin.Forms to 2.4.0.38779. The program will crashed when call the DataGrid.GetRowHeight().

(see attachment: Mono Framework 4.8.1.png.zip)

But, when I compile the sample code with Mono Framework 4.8.1 (without changing anything, Xamarin.Forms 2.3.3.180), everything work well.

(see attachment: Mono Framework 5.4.1.6.png.zip)

Therefore, when will this be fix in Xamarin.Forms 2.4.0.38779 with Mono Framework 5.4.1.6 ?


Cheers,

CT



Attachment: Mono_Framework_5.4.1.6.png_fb34d37e.zip

CT CHANG
Replied On November 6, 2017 11:23 PM

Hi Ashok,

Here is another attached screen captured. Which I missed out in my previous post.

Cheers,

CT


Attachment: Mono_Framework_4.8.1.png_403deb1f.zip

CT CHANG
Replied On November 6, 2017 11:38 PM

Hi Ashok,

Here is another exception stack trace captured by RayGun.

Cheers,
CT

Attachment: ExceptionByRaygun_8d3794cb.zip

Ashok N [Syncfusion]
Replied On November 7, 2017 07:58 AM

Hi Chang, 
 
We are sorry for the inconvenience caused. 
 
We have checked your screenshot and you are using Xamarin.Forms v2.4.0.38779 but we have support Xamarin.Forms v2.3.3.180 to our Syncfusion controls in 2017 Vol 3 SP2 release. Xamarin.Forms v2.4 stable version has been released after we freeze the 2017 Vol 3 SP2 release so this Syncfusion version won’t support Xamarin.Forms latest version. We will provide the Xamarin.Forms v2.4.0.280 support to our Syncfusion controls in our upcoming 2017 Vol 4 main release which will be schedule for rolls out within this week.  
 
You can get the details about the Syncfusion Xamarin.Forms components compatible from the below link:  
  
  
 
Note: We are able to reproduce the reported NullReferenceException with Xamarin.Forms v2.4.0.38779 and SfDataGrid v15.3.0.33 because of Xamarin.Forms version mismatch. This will be work with 2017 Vol 4 main release.  
 
Regards, 
Ashok 


CT CHANG
Replied On November 7, 2017 05:18 PM

Hi Ashok,

That great, and I will wait for the coming up 2017 Vol4 release.

Cheers,
CT

Ashok N [Syncfusion]
Replied On November 8, 2017 12:53 AM

Hi Chang, 
 
Thanks for your update, we will update you once release gets rolled out.  
 
Regards, 
Ashok 


CT CHANG
Replied On November 13, 2017 09:36 PM

Hi Ashok,

I just updated to the latest Syncfusion.Xamarin.SfDataGrid v15.4.0.17, and the GetRowHeight() work like charm! Thx.


Cheers,
T

Ashok N [Syncfusion]
Replied On November 13, 2017 10:58 PM

Hi Chang,  
  
Thanks for your update, please let us know if you require further assistance on this.  
  
Regards,  
Ashok  



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.

;