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); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)