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.

SfListView Row Dragging and HasUnevenRows?

Thread ID:

Created:

Updated:

Platform:

Replies:

128352 Jan 16,2017 12:16 PM Nov 2,2017 12:58 PM Xamarin.Forms 11
loading
Tags: SfListView
Emil
Asked On January 16, 2017 12:16 PM

I would like to change my layout from sfDataGrid to sfListView. But I would like to know, Is there an attribute like  "HasUnevenRows" ListView of xamarin.forms. I read the documentation but I cant find it. 
Does sfListView implements row (item) dragging if I want to move an item up or down? 

Pannir Selvam S [Syncfusion]
Replied On January 17, 2017 01:47 AM

Hi Emil,   
   
Currently SfListView do not have support for “HasUnevenRows” and “Row Drag and Drop”. we have already considered this as feature request and added it into our feature request list, and the feature will be available in any of our upcoming releases. We will update you once the feature has been implemented. 
    
Regards,   
Pannir 


Emil
Replied On January 17, 2017 01:54 AM

Hi Pannir, 
Thank you for your reply. Then I will first stick with sfdatagrid. Can you please let me know how can i achieve hasunevenrows with sfdatagrid if I an using custom template? 

Divakar Subramaniam [Syncfusion]
Replied On January 18, 2017 02:32 AM

Hi Emil, 
 
In SfDataGrid, it is possible to set different row heights for different rows even if you are using custom template. You can set the row height for particular row using SfDataGrid.QueryRowHeight event. Please refer the below code snippet for better understand. 
dataGrid.QueryRowHeight += DataGrid_QueryRowHeight; 
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    if(e.RowIndex == 2) 
    { 
        e.Height = SfDataGridHelpers.GetRowHeight(dataGrid,2); 
        e.Handled = true; 
    } 
} 
You can get the particular row height of SfDataGrid by calling GetRowHeight() method. Now the second row in the SfDataGrid will be layout based on the cell content. You can modify the above code snippet based on your requirement. 
 
Also, we have attached a simple sample for your reference and you can download the same from the below link. 
 
Regards, 
Divakar. 


Emil
Replied On January 18, 2017 12:05 PM

Hi Divakar, 

Sorry but this is not what I am asking for. what you describe is based on index. I wouldn't know which index has different height. that's why xamarin.forms calls it "hasunevenrows". that is ambiguous and it should be adjusted automatically. 

Thanks,

Emil 

Divakar Subramaniam [Syncfusion]
Replied On January 18, 2017 11:36 PM

Hi Emil, 
 
SfDataGrid.QueryRowHeight event will be fired while layout each row in SfDataGrid. For your reference only, we have set the row height based on cell content for second row only. However, you can set the row height for all the rows in SfDataGrid based on their cell contents. Please refer the below code snippet. 
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    e.Height = SfDataGridHelpers.GetRowHeight(dataGrid, e.RowIndex); 
    e.Handled = true; 
} 
 
In the above case, the header row also adjusted automatically based on header text. If you need to skip the header row alone, then please refer the below code snippet. 
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    if(e.RowIndex > 0) 
    { 
        e.Height = SfDataGridHelpers.GetRowHeight(dataGrid,e.RowIndex); 
        e.Handled = true; 
    } 
} 
 
We have modified the sample for your reference and you can download the same from the below link. 
 
Regards, 
Divakar. 


Emil
Replied On January 19, 2017 06:43 AM

Hi Divakar,

this is awesome. I am not sure about the performance. I need to test it further. I have complicated layout using repeater stacklayouts dynamically generated inside a listview. I tried this on android and it worked without any problem but on UWP there is huge bug in xamarin.forms. some labels are not appearing when page is loaded but resizing the app or rotating in mobile uwp, triggers them to appear. you can find the bug report here https://bugzilla.xamarin.com/show_bug.cgi?id=44973

I spent a whole huge time to find a workaround on this using whatever layout available out there and I need to give you big credit and thanks that sfdatagrid is just working fine without any single change but just replacing XF listview with sfdatagrid. 

thanks,

Emil 

Divakar Subramaniam [Syncfusion]
Replied On January 19, 2017 11:03 PM

Hi Emil, 
 
Thanks for the update. We are delighted to hear that your issue has been resolved. 
 
Regards, 
Divakar. 


Emil
Replied On May 8, 2017 08:25 PM

Hi Divakar, I found a bug on your suggestion. basically using code like below works in general but there are some cases, it fails. Let me go through scenario.I have 4 items SfDatagrid.ListItems, but when page is loaded 3 of them are displayed, so the functions is called 3 times (not 4 times) I am believe, it is not getting called for each item but each visible row on the screen, What is interestingly happening is if these 3 rows dont fill the screen, 4th one appears maybe %20-30 at the bottom, since this one didnt get an actual height, it blocks the scrolling, I am not able to scroll to bring entire 4th row. sfDatagrid looks like frozen. This is only happening if I load the data in OnAppearing method. Can you guess what might cause this error? I tried working around this by fixing Height for the datatemplate but it didnt work. I tried also scrollingmode as pixel and pixelline, both didnt fix.screen looks like as below.screenThanks for your help,Emilprivate void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) {     if(e.RowIndex > 0)     {         e.Height = SfDataGridHelpers.GetRowHeight(dataGrid,e.RowIndex);         e.Handled = true;     } }PS: sorry for this format above but your forum has some problems. whatever I do I cant reformat this. I will probably create an incident with a sample app. 

Pavithra  Sivakumar [Syncfusion]
Replied On May 9, 2017 11:25 PM

Hi Emil, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query. We have tried to run your sample which you gave in previous update. But we were not able to restore the nugets in your sample. However, We have prepared sample with reference of given sample, based on your requirement. But we are unable to reproduce the issue. Please reproduce the issue in the attached sample and revert us  with clear replication procedure for further proceed or revert us with your  runnable sample. 
 
 
Regards, 
Pavithra S 
 


Jairo Martins Marques
Replied On November 1, 2017 02:33 PM

Hi Pannir,

any news about “HasUnevenRows” and “Row Drag and Drop”?

Regards,

Jairo Marques


Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On November 2, 2017 12:58 PM

Hi Jairo, 
 
We would like to let you know that the implementation of “HasUnevenRows support for SfListView” has been completed and it is included in our main release Volume 2, 2017 (Version 15.2.0.40). Please refer the below documentation link to know how to use the AutoFitMode property and to customize the item size based on demand in SfListView. 
 
 
Currently we are working on the “Row Drag and Drop support for SfListView”. We have planned to complete our implementation and include this in our main release Volume 4, 2017 which is scheduled to be rolled out by first week of November. 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu Kumaran. 


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.

;