user1371541
user1371541

Reputation: 43

Windows Mobile Service Queries in WP8

http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data-dotnet/#update-app

I'm the beginner of WP8, and I follow the above tutorial to create a mobile service that I can insert/update/delete/query the tables in the cloud.

My question is, in the Query function (RefreshToDoItem):

private void RefreshTodoItems()
{                       
    // This query filters out completed TodoItems. 
    items = todoTable
       .Where(todoItem => todoItem.Complete == false)
       .ToCollectionView();


ListItems.ItemsSource = items;            


}

The "items" is a MobileServiceCollectionView object which can be used as a data source to display in a container.

But how can I retrive one of these result - I mean the data of a specific "field / column" that I can used for other purposes ??

Thanks a lot!

Upvotes: 0

Views: 140

Answers (1)

carlosfigueira
carlosfigueira

Reputation: 87308

You can use the other methods of the query object, such as ToListAsync or ToEnumerableAsync, and get the data from there:

// This query filters out completed TodoItems. 
items = await todoTable
   .Where(todoItem => todoItem.Complete == false)
   .ToListAsync();
var firstItem = items.First();
var text = firstItem.Text;

Upvotes: 3

Related Questions