bool isLoading = false;
public bool IsLoading
{
get { return isLoading;}
set
{
isLoading = value;
OnPropertyChanged("IsLoading");
}
}
public ContactsViewModel()
{
contactsinfo = new ObservableCollection<Contacts>();
LoadMoreData();
}
public async void LoadMoreData()
{
IsLoading = true;
await Task.Delay(3000);
for (int i = 0; i < 40; i++)
{
var contact = new Contacts();
contact.UserId = Id++;
contact.ContactName = CustomerNames[i];
contactsinfo.Add(contact);
}
IsLoading = false;
} |
<Grid>
<syncfusion:SfListView x:Name="listView" ItemSize="60"
ItemsSource="{Binding ContactsInfo}">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Grid x:Name="grid" RowSpacing="1">
…
</Grid>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
<Grid x:Name="grid" IsVisible="{Binding IsLoading,Mode=TwoWay}"
HorizontalOptions="Center"
VerticalOptions="Center" BackgroundColor="Blue">
<Label Text="Loading" TextColor="White"/>
</Grid>
</Grid> |
Hi Dinesh,
thanks for your great suggestion. I am curious if somethin similar is not possible using Sf busyindicator? Is it working for entire page only?
thanks,
Emil
<Grid>
<syncfusion:SfListView x:Name="listView" FooterSize="40" ItemSize="60"
ItemsSource="{Binding ContactsInfo}">
</syncfusion:SfListView>
<busyindicator:SfBusyIndicator x:Name="busyindicator"
AnimationType="SlicedCircle"
IsVisible="{Binding IsLoading,Mode=TwoWay}"
IsBusy="{Binding IsLoading,Mode=TwoWay}"
ViewBoxWidth = "20" ViewBoxHeight="20"
TextColor="Maroon" />
</Grid> |