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

How to inline edit SfListView items during runtime?

Is there a way to edit SfListView during runtime? My requirement is to create checklist items using SfListview and tapping on item should allow it to edit and clicking anywhere outside should save it. Is that possible???

Editing listview item can be done by using modal popup, but I need inline editing method.

3 Replies

JN Jayaleshwari N Syncfusion Team November 29, 2018 06:18 AM UTC

Hi Subha, 
Thanks for Contacting Syncfusion Support. 
We have checked the reported query “How to inline edit SfListView items during runtime?” from our side. You can achieve your requirement by loading Editor in SelectedItemTemplate with OneWay binding mode for particular property to avoid immediate update to property. And explicitly set the editor value to bound object when editor is unfocused using editor events. 
Code snippet XAML: Editor will be loaded when tap on the listview item. 
        <Editor x:Name="editorContactName" Text="{Binding ContactName, Mode=OneWay}"> 
Code snippet C#: Editor value will be committed when you click outside              
public class EditorBehavior : Behavior<Editor> 
    private void OnEditorUnfocused(object sender, FocusEventArgs e) 
        var editor = sender as Editor; 
        var bindingContext = editor.BindingContext as Contacts; 
        bindingContext.ContactName = editor.Text; 
We have attached the sample for your reference and you can download the same from the following location. 
Note: LsitView can show case multiple property binding in ItemTemplate and using virtualization concept. So, you need to handle the each property for editing. You can refer our SfDataGrid for inline editing which supports editing and validation with templates. 
Please let us know if you would require further assistance. 
Jayaleshwari N. 

GJ Gautam Jain January 15, 2019 06:57 AM UTC

Thanks a lot Jayaleshwari.

It is working well. How can I close back the editor and show the original view that existed before selecting the item (and going in edit mode).

Meaning, the editor closes only when I select another item where another item goes in edit mode.

I want to close the editor when focus goes out of the editor.

Can you help please?

MK Muthu Kumaran Gnanavinayagam Syncfusion Team January 16, 2019 12:47 PM UTC

Hi Gautam, 
We have checked the reported query “Need to disable/enable edit mode when needed” from our side. We have modified our sample to achieve the reported requirement. In our sample, we have added 2 buttons along with Editor control to choose whether the edited text have to be replaced in the model data. 
For your reference, we have attached the modified sample and you can download it from the below link. 
Please let us know if you require further assistance. 
G.Muthu kumaran. 

Live Chat Icon For mobile
Up arrow icon