Show Indeterminate progress bar during incremental loading
-
Saturday, August 18, 2012 4:23 AM
I have been able to implement incremental loading for one of my gridviews. However, I would like to show an indeterminate progress bar when it is retrieving more data for the next page.
I created a generic incremental loading class which handles all the work for me, and then I have a view model property of that class type (see code snippet below).
Is there a property on the grid view that helps indicate when incremental loading is happening?
<GridView x:Name="gvBillItems" AutomationProperties.AutomationId="GVBills" AutomationProperties.Name="BillItems" TabIndex="1" Grid.Row="2" IncrementalLoadingTrigger="Edge" Margin="0,-4,0,0" Padding="116,0,116,46" ItemsSource="{Binding Bills}" ItemTemplate="{StaticResource AllBillsGVDataItemTemplate}"/>
private IncrementalSource<OpenCongressService, BillDetail> _bills = new IncrementalSource<OpenCongressService, BillDetail>(); public IncrementalSource<OpenCongressService, BillDetail> Bills { get { return _bills; } set { if (_bills == value) { return; } _bills = value; NotifyPropertyChanged("Bills"); } }
Look forward to some responses.Dele O.
All Replies
-
Saturday, August 18, 2012 10:41 AM
Hello Dele_O,
as far as I know there's no such property but you can easily create it yourself.
At the moment I can think about to possible implementations for that. Either you fire an event when your datasource is loading more items (LoadMoreItemsAsync is called) and subscribe to it in your view model. Another way would be to implement a property e.g. IsLoading in your datasource to which you can bind in your view. I probably would prefer the latter.
For instance
internal class IncrementalSource : INotifyPropertyChanged { private bool _isLoading; public bool IsLoading { get { return _isLoading; } private set { if( !Equals( _isLoading, value ) ) { _isLoading = value; RaisePropertyChanged(); } } } ... private async Task<LoadMoreItemsResult> LoadMoreItemsAsync(CancellationToken c, uint count) { IsLoading = true; ... IsLoading = false; } }
Your view could then bind to Bills.IsLoading.
- Edited by Sven.Me Saturday, August 18, 2012 10:41 AM
- Edited by Sven.Me Saturday, August 18, 2012 10:58 AM Corrected some typos
- Marked As Answer by Matt SmallMicrosoft Employee, Moderator Wednesday, August 22, 2012 1:31 PM


