Я думаю, что вы скучаете по связыванию контекста. Добавьте код ниже.
this.BindingContext = this;
Я делаю пример кода для вашей справки. Я не уверен, что ваша модель, я использую простую модель для тестирования.
Page1.xaml.cs
public partial class Page1 : ContentPage
{
public ObservableCollection<Dashboard> DetailsList { get; set; }
public Page1()
{
InitializeComponent();
DetailsList = new ObservableCollection<Dashboard>()
{
new Dashboard(){ Name="AA", Country="CountryA"},
new Dashboard(){ Name="BB", Country="CountryB"},
};
this.BindingContext = this;
}
private void btnUpdate_Clicked(object sender, EventArgs e)
{
List<Dashboard> details = new List<Dashboard>();
details.Add(new Dashboard() { Name = "CC", Country = "CountryC" });
details.Add(new Dashboard() { Name = "DD", Country = "CountryD" });
if (details != null)
{
DetailsList.Clear();
foreach (var item in details)
{
DetailsList.Add(item);
}
}
}
}
public class Dashboard
{
public string Name { get; set; }
public string Country { get; set; }
}
Xaml:
<ContentPage.Content>
<StackLayout>
<Button
x:Name="btnUpdate"
Clicked="btnUpdate_Clicked"
Text="Update" />
<ListView ItemsSource="{Binding DetailsList}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Name}" />
<Label Text="{Binding Country}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
![enter image description here](https://i.stack.imgur.com/VzjSr.gif)
Обновлено:
![enter image description here](https://i.stack.imgur.com/i7ja0.gif)