Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I add Search to Declarations. And I add search contract from new item. But I run the program, click search(on charms), insert some word and press enter. But the word which is I entered isn't come in to QueryText. How I Solve this? My project is nearly finish but I cant do this "search".
C#
public sealed partial class SearchResultsMainPage : TurkiyeIftarVakitleri.Common.LayoutAwarePage
   {
       public SearchResultsMainPage()
       {
           this.InitializeComponent();
       }
       protected override void LoadState(Object navigationParameter, Dictionary<String, Object>    pageState)
       {
           var queryText = navigationParameter as String;
           var filterList = new List<Filter>();
           filterList.Add(new Filter("All", 0, true));
           this.DefaultViewModel["QueryText"] = '\u201c' + queryText + '\u201d';
           this.DefaultViewModel["Filters"] = filterList;
           this.DefaultViewModel["ShowFilters"] = filterList.Count > 1;
       }
       void Filter_SelectionChanged(object sender, SelectionChangedEventArgs e)
       {
           // Determine what filter was selected
           var selectedFilter = e.AddedItems.FirstOrDefault() as Filter;
           if (selectedFilter != null)
           {
               // Mirror the results into the corresponding Filter object to allow the
               // RadioButton representation used when not snapped to reflect the change
               selectedFilter.Active = true;

               // TODO: Respond to the change in active filter by setting this.DefaultViewModel["Results"]
               //       to a collection of items with bindable Image, Title, Subtitle, and Description properties

               // Ensure results are found
               object results;
               ICollection resultsCollection;
               if (this.DefaultViewModel.TryGetValue("Results", out results) &&
                   (resultsCollection = results as ICollection) != null &&
                   resultsCollection.Count != 0)
               {
                   VisualStateManager.GoToState(this, "ResultsFound", true);
                   return;
               }
           }

           // Display informational text when there are no search results.
           VisualStateManager.GoToState(this, "NoResultsFound", true);
       }
       void Filter_Checked(object sender, RoutedEventArgs e)
       {
           // Mirror the change into the CollectionViewSource used by the corresponding ComboBox
           // to ensure that the change is reflected when snapped
           if (filtersViewSource.View != null)
           {
               var filter = (sender as FrameworkElement).DataContext;
               filtersViewSource.View.MoveCurrentTo(filter);
           }
       }
Posted
Updated 16-Jul-13 3:12am
v2
Comments
Naz_Firdouse 16-Jul-13 8:25am    
are you checking the QueryText in OnSearchActivated event???
Post you r code so that we can help you
berkayerdi 16-Jul-13 9:13am    
How I can check ?
berkayerdi 16-Jul-13 9:17am    
The problem in there: the pointer isn't entered here. But When I make search pointer should be come there.

1 solution

I think this samples will help you
http://code.msdn.microsoft.com/windowsapps/Search-app-contract-sample-118a92f5[^]

Thanks,
Bilaal
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900