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
close icon

SfListView Row Dragging and HasUnevenRows?

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? 

11 Replies

PS Pannir Selvam S Syncfusion Team January 17, 2017 06:47 AM UTC

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 



EM Emil January 17, 2017 06:54 AM UTC

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? 


DS Divakar Subramaniam Syncfusion Team January 18, 2017 07:32 AM UTC

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. 



EM Emil January 18, 2017 05:05 PM UTC

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 


DS Divakar Subramaniam Syncfusion Team January 19, 2017 04:36 AM UTC

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. 



EM Emil January 19, 2017 11:43 AM UTC

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 


DS Divakar Subramaniam Syncfusion Team January 20, 2017 04:03 AM UTC

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



EM Emil May 9, 2017 12:25 AM UTC

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. 


PS Pavithra  Sivakumar Syncfusion Team May 10, 2017 03:25 AM UTC

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 
 



JM Jairo Martins Marques November 1, 2017 06:33 PM UTC

Hi Pannir,

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

Regards,

Jairo Marques



MK Muthu Kumaran Gnanavinayagam Syncfusion Team November 2, 2017 04:58 PM UTC

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. 


Loader.
Live Chat Icon For mobile
Up arrow icon