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

Databinding will not work


I am having problems getting the below code to work. To get it to work all I have to do if un-comment the highlighted text. It looks like a bug?

@page "/test"
@using Syncfusion.EJ2.Blazor.Lists
@using System.Collections.ObjectModel
@using Newtonsoft.Json

<button @onclick="AddNew">ADD NEW OBJECT</button>
<EjsListView DataSource="@addresses"
            <div class="e-list-wrapper">
                <span class="e-list-content">@((context as PickUpPoint).Address)</span>
    void AddNew()
        addresses.Add(new PickUpPoint {Address = "an address" });
    ObservableCollection<PickUpPoint> addresses = new ObservableCollection<PickUpPoint>();
    PickUpPoint addressType = new PickUpPoint();
    public class PickUpPoint
        public string Address { get; set; } = string.Empty;
        public double Lat { get; set; } = 0;
        public double Lon { get; set; } = 0;
        public string Coordinates { get { return $"{Lat.ToString()} {Lon.ToString()}"; }}


3 Replies

MK Muthukrishnan Kandasamy Syncfusion Team December 9, 2019 11:08 AM UTC

Hi Paul, 
Thanks for contacting Syncfusion support. 
You can use the following code block to return the coordinates value in the ListView component. 
Refer to the below code block: 
public string Coordinates() 
            return $"{ Lat.ToString()} {Lon.ToString()}"; 
We have prepared sample with your code for your reference. Kindly refer to the below link for the link. 
Sample link:  
Please let us know if you have any concerns. 
Muthukrishnan K 

PS paul stanley December 9, 2019 07:26 PM UTC

Ok thank you. Is there any reason why you can not use a calculated property?

SP Sowmiya Padmanaban Syncfusion Team December 11, 2019 12:46 PM UTC

Hi Paul, 
It is possible to use the calculated property in Listview component. We have checked your attached code snippet, we have sorted out the issue that Coordinates are not declared properly in your code snippet. 
 Refer the below code snippet for declaring the Coordinates in your application. 
public string Coordinates 
                return $"{this.Lat.ToString()} {this.Lon.ToString()}"; 
To your reference, we have prepared a sample using calculated property. Refer the sample link below. 
Please let us know, if you have any concerns. 

Live Chat Icon For mobile
Up arrow icon