你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

MobileServiceCollection<TTable,TCollection> 类

定义

一个异步数据源,它可通过 Xaml 集合控件(例如 ListView、GridView 或 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

类型参数

TTable

数据源元素类型。

TCollection

在集合中结束的元素的类型。

继承
MobileServiceCollection<TTable,TCollection>
派生
实现

注解

当前处理异步加载数据,通知控件和分页。 MobileServiceCollection<T>如果表项和集合项属于同一类型,请使用 类。

构造函数

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

初始化 IncrementalLoadingMobileServiceCollection{TTable, TCollection} 类的新实例。

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

初始化 IncrementalLoadingMobileServiceCollection{TTable, TCollection} 类的新实例。

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

初始化 IncrementalLoadingMobileServiceCollection{TTable, TCollection} 类的新实例。 当 TTable 和 TCollection 是同一类型时,应使用此构造。

字段

selectorFunction

在数据从服务器返回时将应用于这些数据的选择器函数。

属性

HasMoreItems

获取一个值,该值指示是否有可增量加载的更多项。

NextLink

获取指向响应标头中返回的下一页结果的链接。

PageSize

在构造函数中指定的页大小。

TotalCount

获取已返回的所有记录(并且忽略客户端或服务器指定的任何 take paging/limit 子句)的总数。

方法

LoadMoreItemsAsync(CancellationToken, Int32)

以异步方式加载更多项。 控制何种情况下支持增量加载,例如,Windows 8 上的 GridView 自动调用此方法。 在其他情况下,您应该自己调用此方法。

LoadMoreItemsAsync(Int32)

以异步方式加载更多项。 控制何种情况下支持增量加载,例如,Windows 8 上的 GridView 自动调用此方法。 在其他情况下,您应该自己调用此方法。

OnPropertyChanged(String)

调用 propertyName 属性的 PropertyChanged 事件。 提供一个针对子类的方法以便重写事件调用行为。

PrepareDataForCollection(IEnumerable<TTable>)

使用提供的选择器函数将来自查询的数据转换为集合数据。

PrepareDataForCollection(TTable)

使用提供的选择器函数将一项转换为集合项。

ProcessQueryAsync(CancellationToken, IMobileServiceTableQuery<TTable>)

对查询进行评估并且将结果添加到集合中。

事件

LoadingComplete

在完成加载项时发生。 提供 LoadingCompleteEventArgs 已加载的项数。

LoadingItems

开始加载项时 LoadMoreItemsAsync(Int32) 发生。

扩展方法

ToCommaSeparatedString<T>(IEnumerable<T>)

将集合的元素转换为字符串,并将它们连接成逗号分隔列表,或者为 null 或空集合返回 null。

适用于