private void AutoComplete_Populating(object sender, PopulatingEventArgs e) { // Search for matching foods and make sure that the ServingSize information is returned FoodContext autocompleteContext = new FoodContext(); AutoComplete.ItemsSource = autocompleteContext.Foods; autocompleteContext.Load <FitnessTrackerPlus.Web.Data.Food>(autocompleteContext.SearchFoodsQuery(Globals.CurrentUser.id, Globals.MaxAutoCompleteResults, AutoComplete.Text, true), LoadBehavior.RefreshCurrent, (FoodsLoaded) => { if (!FoodsLoaded.HasError) { AutoComplete.PopulateComplete(); if (FoodsLoaded.TotalEntityCount == 0) { SearchingText.Text = "No foods found"; } } }, null); e.Cancel = true; }