protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { Random random = new Random(); Uri uri = new Uri("ms-appx:///Assets/background_" + random.Next(1, 7) + ".jpg", UriKind.RelativeOrAbsolute); ImageBrush background = new ImageBrush(); background.ImageSource = new BitmapImage(uri); this.SplitPage_Main_Grid.Background = background; var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; if (pageState == null) { this.itemListView.SelectedItem = null; if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } } else { if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } }
private async void Favorite_Button_Click(object sender, RoutedEventArgs e) { var y = this.itemGridView.SelectedItems; if (this.itemGridView.Visibility == Windows.UI.Xaml.Visibility.Collapsed) { y = this.itemListView.SelectedItems; } foreach (var x in y) { SampleDataItem i = x as SampleDataItem; var f = SampleDataSource.GetGroup("Favorites"); i.isFav = true; if (!SampleDataSource.FavoriteManager.isFavorite(int.Parse(i.UniqueId))) { await SampleDataSource.addToGroupByNum(int.Parse(i.UniqueId), f); } SampleDataSource.FavoriteManager.WriteFavs(); } SampleDataSource.FavoriteManager.WriteFavs(); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Create an appropriate data model for your problem domain to replace the sample data var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; if (pageState == null) { this.itemListView.SelectedItem = null; // When this is a new page, select the first item automatically unless logical page // navigation is being used (see the logical page navigation #region below.) if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } } else { // Restore the previously saved state associated with this page if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } }
/// <summary> /// Вызывается при выборе фильтра с помощью поля со списком в состоянии прикрепленного представления. /// </summary> /// <param name="sender">Экземпляр ComboBox.</param> /// <param name="e">Данные о событии, описывающие, каким образом был изменен выбранный фильтр.</param> void Filter_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Определить, какой фильтр был выбран var selectedFilter = e.AddedItems.FirstOrDefault() as Filter; if (selectedFilter != null) { // Зеркальное отображение результатов в соответствующий объект Filter, чтобы представление // RadioButton, используемое без прикрепления, могло отразить изменение selectedFilter.Active = true; SampleDataGroup group1 = SampleDataSource.GetGroup("Group-1"); SearchResults = group1.Items.Where(c => c.Title.ToString().ToLower().Contains(this.DefaultViewModel["QueryText"].ToString().ToLower()) || c.Description.ToString().ToLower().Contains(this.DefaultViewModel["QueryText"].ToString().ToLower())).ToList <SampleDataItem>(); this.DefaultViewModel["Results"] = SearchResults; // TODO: Ответить на изменение в активном фильтре, задав для this.DefaultViewModel["Results"] // коллекцию элементов с привязываемыми свойствами Image, Title, Subtitle и Description // Убедитесь, что результаты найдены 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; } } // Отображение информационного текста, который выводится при отсутствии результатов поиска. VisualStateManager.GoToState(this, "NoResultsFound", true); }
/// <summary> /// Rellena la página con el contenido pasado durante la navegación. Cualquier estado guardado se /// proporciona también al crear de nuevo una página a partir de una sesión anterior. /// </summary> /// <param name="navigationParameter">Valor de parámetro pasado a /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página. /// </param> /// <param name="pageState">Diccionario del estado mantenido por esta página durante una sesión /// anterior. Será null la primera vez que se visite una página.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Crear un modelo de datos adecuado para el dominio del problema para reemplazar los datos de ejemplo var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; if (pageState == null) { this.itemListView.SelectedItem = null; // Si es una página nueva, seleccionar el primer elemento automáticamente a menos que se esté usando // navegación de página lógica (ver la sección #region de navegación de página lógica a continuación.) if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } } else { // Restaurar el estado guardado previamente asociado con esta página if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } }
private void UnFavorite_Button_Click(object sender, RoutedEventArgs e) { var y = this.itemGridView.SelectedItems; if (this.itemGridView.Visibility == Windows.UI.Xaml.Visibility.Collapsed) { y = this.itemListView.SelectedItems; } foreach (var x in y) { SampleDataItem i = x as SampleDataItem; var f = SampleDataSource.GetGroup("Favorites"); i.isFav = false; var m = SampleDataSource.GetGroup("XKCD").getIfExists(i.UniqueId.Trim()); m.isFav = false; //var r = f.getIfExists((i.UniqueId )); var ff = f.Items; ff.Remove(i); } this.itemListView.SelectedItems.Clear(); SampleDataSource.FavoriteManager.WriteFavs(); }
/// <summary> /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを /// 再作成する場合は、保存状態も指定されます。 /// </summary> /// <param name="navigationParameter">このページが最初に要求されたときに /// <see cref="Frame.Navigate(Type, Object)"/> に渡されたパラメーター値。 /// </param> /// <param name="pageState">前のセッションでこのページによって保存された状態の /// ディクショナリ。ページに初めてアクセスするとき、状態は null になります。</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: 問題のドメインでサンプル データを置き換えるのに適したデータ モデルを作成します var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; if (pageState == null) { this.itemListView.SelectedItem = null; // 新しいページの場合、論理ページ ナビゲーションが使用されている場合を除き、自動的に // 最初のアイテムを選択します (以下の論理ページ ナビゲーションの #region を参照)。 if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } } else { // このページに関連付けられている、前に保存された状態を復元します if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } }
public ClothesSelect() { this.InitializeComponent(); ps.ShowDialog(); fullPosture.Source = ps.MyValue; postureId = ps.PostureId; if (postureId == null) { this.Close(); } try { sampleDataSource = new SampleDataSource("Track", "call getClothesImage(" + postureId + ")"); this.itemsControl.ItemsSource = sampleDataSource.GetGroup(); values = sampleDataSource.GetValueGroup(); DBon(); } catch { Console.WriteLine("자세Id 못받았음"); } }
/// <summary> /// Remplit la page à l'aide du contenu passé lors de la navigation. Tout état enregistré est également /// fourni lorsqu'une page est recréée à partir d'une session antérieure. /// </summary> /// <param name="navigationParameter">Valeur de paramètre passée à /// <see cref="Frame.Navigate(Type, Object)"/> lors de la requête initiale de cette page. /// </param> /// <param name="pageState">Dictionnaire d'état conservé par cette page durant une session /// antérieure. Null lors de la première visite de la page.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: créez un modèle de données approprié pour le domaine posant problème pour remplacer les exemples de données var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// 使用在导航过程中传递的内容填充页。在从以前的会话 /// 重新创建页时,也会提供任何已保存状态。 /// </summary> /// <param name="navigationParameter">最初请求此页时传递给 /// <see cref="Frame.Navigate(Type, Object)"/> 的参数值。 /// </param> /// <param name="pageState">此页在以前会话期间保留的状态 /// 字典。首次访问页面时为 null。</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: 创建适用于问题域的合适数据模型以替换示例数据 var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Create an appropriate data model for your problem domain to replace the sample data group = SampleDataSource.GetGroup((String)navigationParameter); DefaultViewModel["Group"] = group; DefaultViewModel["Items"] = group.Items; DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested; }
/// <summary> /// Rellena la página con el contenido pasado durante la navegación. Cualquier estado guardado se /// proporciona también al crear de nuevo una página a partir de una sesión anterior. /// </summary> /// <param name="navigationParameter">Valor de parámetro pasado a /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página. /// </param> /// <param name="pageState">Diccionario del estado mantenido por esta página durante una sesión /// anterior. Será null la primera vez que se visite una página.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Crear un modelo de datos adecuado para el dominio del problema para reemplazar los datos de ejemplo var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// Заполняет страницу содержимым, передаваемым в процессе навигации. Также предоставляется любое сохраненное состояние /// при повторном создании страницы из предыдущего сеанса. /// </summary> /// <param name="sender"> /// Источник события; как правило, <see cref="NavigationHelper"/> /// </param> /// <param name="e">Данные события, предоставляющие параметр навигации, который передается /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы и /// словарь состояний, сохраненных этой страницей в ходе предыдущего /// сеанса. Это состояние будет равно NULL при первом посещении страницы.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { // TODO: Создание соответствующей модели данных для области проблемы, чтобы заменить пример данных var group = SampleDataSource.GetGroup((String)e.NavigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// Заполняет страницу содержимым, передаваемым в процессе навигации. Также предоставляется любое сохраненное состояние /// при повторном создании страницы из предыдущего сеанса. /// </summary> /// <param name="navigationParameter">Значение параметра, передаваемое /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы. /// </param> /// <param name="pageState">Словарь состояния, сохраненного данной страницей в ходе предыдущего /// сеанса. Это значение будет равно NULL при первом посещении страницы.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Создание соответствующей модели данных для области проблемы, чтобы заменить пример данных var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Create an appropriate data model for your problem domain to replace the sample data var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Create an appropriate data model for your problem domain to replace the sample data var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; //TealiumTagger.Instance.TrackScreenViewed("group-details", new Dictionary<string, string>() { { "group-id", group.UniqueId }, { "custom-1", "value-1" } }); }
private void setData(DotNetWikiBot.Page page) { SampleDataSource sampleDataSourceRoot = new SampleDataSource(); sampleDataSourceRoot.setDataSource(page); var sampleDataSource = SampleDataSource.GetGroup(page.pageId); this.itemsControl.ItemsSource = sampleDataSource; }
private void UnFavorite_Button_Click(object sender, RoutedEventArgs e) { var i = (this.flipView.SelectedItem as SampleDataItem); var f = SampleDataSource.GetGroup("Favorites"); i.isFav = false; f.Items.Remove(f.getIfExists((i.UniqueId + " "))); this.bottomAppBar.IsOpen = false; SampleDataSource.FavoriteManager.WriteFavs(); }
private void Home_Button_Click(object sender, RoutedEventArgs e) { if (this.pageTitle.Text != "XKCD") { this.Frame.GoBack(); this.Frame.Navigate(typeof(GroupDetailPage), SampleDataSource.GetGroup("Favorites").Items[0].UniqueId); } else { this.Frame.GoBack(); } }
private async void Favorite_Button_Click(object sender, RoutedEventArgs e) { var i = (this.flipView.SelectedItem as SampleDataItem); var f = SampleDataSource.GetGroup("Favorites"); i.isFav = true; if (!SampleDataSource.FavoriteManager.isFavorite(int.Parse(i.UniqueId))) { await SampleDataSource.addToGroupByNum(int.Parse(i.UniqueId), f); } this.bottomAppBar.IsOpen = false; SampleDataSource.FavoriteManager.WriteFavs(); }
private async void Goto_Button_Click(object sender, RoutedEventArgs e) { //add item if needed var g = SampleDataSource.GetGroup("XKCD"); var l = g.Items.Last(); var q = g.getIfExists(Numberbox.Text.Trim()); if (q == null) { int num; if (int.TryParse(Numberbox.Text, out num)) { if (num < int.Parse(g.Items[0].UniqueId) && num >= 1 && num != 404) { await SampleDataSource.addToGroupByNum(num, g); //goto item this.Frame.Navigate(typeof(ItemDetailPage), num.ToString()); await SampleDataSource.fillGroup(l, g.Items.Last()); } else { if (num == 404) { this.errorBox.Text = "Error. Comic #404 doesn't exist."; } else if (num < 1) { this.errorBox.Text = "There aren't actually any negatively numbered comics. Try entering a positive number."; } else { this.errorBox.Text = "That comic doesn't exist (yet). You might want to wait until it is published"; } } } else { this.errorBox.Text = "You might want to try entering a number, rather than something non-numeric."; } } else { this.Frame.Navigate(typeof(ItemDetailPage), q.UniqueId); } Numberbox.Text = ""; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // This is a sample hack - I didn't want to modify too many files in the standard project // In real life, you would have a base collection / vector doing just that var allitems = new List <object>(); allitems.Add(new AddNewItemItem() { InstructionTitle = "Add", InstructionSubtitle = "Please have your ID ready" }); allitems.AddRange(SampleDataSource.GetGroup("Group-1").Items); this.DefaultViewModel["Items"] = allitems; }
private async void Favorites_Button_Click(object sender, RoutedEventArgs e) { if (SampleDataSource.GetGroup("Favorites").Items.Count != 0) { if (this.pageTitle.Text != "Favorites") { this.Frame.GoBack(); } this.Frame.Navigate(typeof(GroupDetailPage), SampleDataSource.GetGroup("Favorites").Items[0].UniqueId); } else { await new Windows.UI.Popups.MessageDialog("You haven't marked any favorites. Try selecting some comics and favoriting them to view in one place.").ShowAsync(); } }
public MainWindow() { InitializeComponent(); KinectRegion.SetKinectRegion(this, kinectRegion); App app = ((App)Application.Current); app.KinectRegion = kinectRegion; // Use the default sensor this.kinectRegion.KinectSensor = KinectSensor.GetDefault(); //// Add in display content var sampleDataSource = SampleDataSource.GetGroup("Group-1"); this.itemsControl.ItemsSource = sampleDataSource; }
public MainWindow() { this.InitializeComponent(); KinectRegion.SetKinectRegion(this, kinectRegion); App app = ((App)Application.Current); app.KinectRegion = kinectRegion; // Usa el sensor por defecto this.kinectRegion.KinectSensor = KinectSensor.GetDefault(); // Añade los botones a la venta principal var sampleDataSource = SampleDataSource.GetGroup("MenuOptions"); this.itemsControl.ItemsSource = sampleDataSource; }
//MainWindow iniciálizációja public MainWindow() { //alapértelmezett Kinect beállítása this.kinectSensor = KinectSensor.GetDefault(); //az colorFrame olvasó megnyitása this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader(); //ha adat érkezik, azt bepakoljuk a colorFrame olvasóba this.colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived; // colorFrame leíró hozzáadása: Bgra formátum használata FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); // bittérkép létehozása: 32 bites színmélység this.colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null); // Kinect állapot-észlelő: ha történik valami a Kinecttel, akkor ebbe megy az infó this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged; // Kinect elindítása this.kinectSensor.Open(); // státusz szöveg beállítása this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText : Properties.Resources.NoSensorStatusText; this.DataContext = this; // komponensek inicializálása az ablak irányításán belül (ez majd bővülni fog) this.InitializeComponent(); KinectRegion.SetKinectRegion(this, kinectRegion); App app = ((App)Application.Current); app.KinectRegion = kinectRegion; //// Add in display content var sampleDataSource = SampleDataSource.GetGroup("Group-1"); this.itemsControl.ItemsSource = sampleDataSource; }
public PostureSelect() { sampleDataSource = new SampleDataSource("Track", "call getPostureImage()"); // 원문 select postureId image from gallery InitializeComponent(); KinectRegion.SetKinectRegion(this, kinectRegion); App app = ((App)Application.Current); app.KinectRegion = kinectRegion; // Use the default sensor this.kinectRegion.KinectSensor = KinectSensor.GetDefault(); //// Add in display content // SampleDataSource ㄳㄲ this.itemsControl.ItemsSource = sampleDataSource.GetGroup(); values = sampleDataSource.GetValueGroup(); }
private async void selectionChanged(object sender, SelectionChangedEventArgs e) { var g = SampleDataSource.GetGroup("XKCD"); //if((e.AddedItems[0] as SampleDataItem).UniqueId == g.Items[g.Items.Count - 2].UniqueId){ // await SampleDataSource.addPreviousN(g.Items.Last(), g, 1); //else if(g.Items.Count == 1) // await SampleDataSource.addPreviousN(g.Items.Last(), g, 1); if (!g.isLoading) { if (e.AddedItems.Count != 0) { var i = (e.AddedItems[0] as SampleDataItem); if (i.Group.Title == "XKCD" && i.Equals(g.Items.Last())) { SampleDataSource.addPreviousN(g.Items.Last(), g, 1).Wait(300); } } } }
/// <summary> /// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.InitializeComponent(); KinectRegion.SetKinectRegion(this, kinectRegion); App app = ((App)Application.Current); app.KinectRegion = kinectRegion; // Use the default sensor this.kinectRegion.KinectSensor = KinectSensor.GetDefault(); //// Add in display content var sampleDataSource = SampleDataSource.GetGroup("Group-1"); this.itemsControl.ItemsSource = sampleDataSource; //RecognizeSpeechAndWriteToConsoleMain1(); System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer(); myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); // 100 Milliseconds myDispatcherTimer.Tick += myDispatcherTimer_Tick; myDispatcherTimer.Start(); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Create an appropriate data model for your problem domain to replace the sample data var group = SampleDataSource.GetGroup((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; if (pageState == null) { this.itemListView.SelectedItem = null; // When this is a new page, select the first item automatically unless logical page // navigation is being used (see the logical page navigation #region below.) if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } } else { // Restore the previously saved state associated with this page if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { var selectedItem = SampleDataSource.GetItem((String)pageState["SelectedItem"]); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } BitmapImage bkgImage = new BitmapImage(); switch (group.UniqueId) { case "Deity1": { bkgImage.UriSource = new Uri("ms-appx:///assets/Ganesha2.png"); break; } case "Deity2": { bkgImage.UriSource = new Uri("ms-appx:///assets/Shiva2.png"); break; } case "Deity3": { bkgImage.UriSource = new Uri("ms-appx:///assets/Lakshmi2.png"); break; } case "Deity4": { bkgImage.UriSource = new Uri("ms-appx:///assets/Tripurasundari2.png"); break; } case "Deity5": { bkgImage.UriSource = new Uri("ms-appx:///assets/Durga2.png"); break; } case "Deity6": { bkgImage.UriSource = new Uri("ms-appx:///assets/Gayathri2.png"); break; } case "Deity7": { bkgImage.UriSource = new Uri("ms-appx:///assets/Hanuman2.png"); break; } case "Deity8": { bkgImage.UriSource = new Uri("ms-appx:///assets/Subramanya2.png"); break; } case "Deity9": { bkgImage.UriSource = new Uri("ms-appx:///assets/Hayagreeva2.png"); break; } default: { break; } } ImageBrush bkgBrush = new ImageBrush(); bkgBrush.ImageSource = bkgImage; grdMain.Background = bkgBrush; }