Share via


MobileServiceCollection<TTable,TCollection> Class

Definition

An asynchronous data source that can wrap the results of a Mobile Services query in a way that's easily consumed by Xaml collection controls like ListView, GridView or ListBox.

public class MobileServiceCollection<TTable,TCollection> : System.Collections.ObjectModel.ObservableCollection<TCollection>, Microsoft.WindowsAzure.MobileServices.IQueryResultEnumerable<TCollection>, Microsoft.WindowsAzure.MobileServices.ITotalCountProvider, System.Collections.Generic.IEnumerable<TCollection>
type MobileServiceCollection<'able, 'Collection> = class
    inherit ObservableCollection<'Collection>
    interface ITotalCountProvider
    interface IQueryResultEnumerable<'Collection>
    interface seq<'Collection>
    interface IEnumerable
Public Class MobileServiceCollection(Of TTable, TCollection)
Inherits ObservableCollection(Of TCollection)
Implements IEnumerable(Of TCollection), IQueryResultEnumerable(Of TCollection), ITotalCountProvider

Type Parameters

TTable

Data source element type.

TCollection

Type of elements ending up in the collection.

Inheritance
MobileServiceCollection<TTable,TCollection>
Derived
Implements

Remarks

Currently handles asynchronously loading the data, notifying the controls and paging. Use the MobileServiceCollection<T> class if the table and collection items are of the same type.

Constructors

MobileServiceCollection<TTable,TCollection>(IMobileServiceTableQuery<TTable>, Func<IEnumerable<TTable>,IEnumerable<TCollection>>, Int32)

Initializes a new instance of the IncrementalLoadingMobileServiceCollection{TTable, TCollection} class.

MobileServiceCollection<TTable,TCollection>(IMobileServiceTableQuery<TTable>, Func<TTable,TCollection>, Int32)

Initializes a new instance of the IncrementalLoadingMobileServiceCollection{TTable, TCollection} class.

MobileServiceCollection<TTable,TCollection>(IMobileServiceTableQuery<TTable>, Int32)

Initializes a new instance of the IncrementalLoadingMobileServiceCollection{TTable, TCollection} class. This constructior should be used in cases where TTable and TCollection are the same type.

Fields

selectorFunction

A selector function which will be appied to the data when it comes back from the server.

Properties

HasMoreItems

Gets a value indicating whether there are more items that can be loaded incrementally.

NextLink

Gets the link to next page of result that is returned in response headers.

PageSize

The page size specified in the constructor.

TotalCount

Gets the total count for all the records that would have been returned ignoring any take paging/limit clause specified by client or server.

Methods

LoadMoreItemsAsync(CancellationToken, Int32)

Load more items asynchronously. Controls which support incremental loading on such as GridView on Windows 8 call this method automatically. In other cases you should call this method yourself.

LoadMoreItemsAsync(Int32)

Load more items asynchronously. Controls which support incremental loading on such as GridView on Windows 8 call this method automatically. In other cases you should call this method yourself.

OnPropertyChanged(String)

Invokes the PropertyChanged event for the propertyName property. Provides a way for subclasses to override the event invocation behavior.

PrepareDataForCollection(IEnumerable<TTable>)

Transforms the data from the query into data for the collection using the provided selector function.

PrepareDataForCollection(TTable)

Transforms one item into an item for the collection using the provided selector function.

ProcessQueryAsync(CancellationToken, IMobileServiceTableQuery<TTable>)

Evaluates the query and adds the result to the collection.

Events

LoadingComplete

Occurs when finished loading items. Provides LoadingCompleteEventArgs with how many items were loaded.

LoadingItems

Occurs when LoadMoreItemsAsync(Int32) starting to load items.

Extension Methods

ToCommaSeparatedString<T>(IEnumerable<T>)

Converts the elements of a collection to strings and concatenates them into a comma-separated list, or returns null for null or empty collections.

Applies to