// Fills the scroll viewer with Albums (an "Album" is a 3x3 frame that holds conceptually related items) private void setupLayoutFrames2() { CollectionFrame frame1 = new CollectionFrame(); // Both x and y can hold the values 1, 2, or 3, and correspond to the position of a Polaroid element // in an Album int x = 1; int y = 1; // Creates 9 Polaroids and places them into a slot in the Album for (int i = 0; i < 9; i++) { BitmapImage src1 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[i].CollectionPicFileName)); Polaroid pol1 = new Polaroid(src1, this, MyDataList.instance.CollectionList[i]); pol1.CollectionTileImage.Name = MyDataList.instance.CollectionList[i].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol1); Grid.SetColumn(pol1, x); Grid.SetRow(pol1, y); y++; if (y == 4) { y = 1; x++; } } // Adds Album to scroll viewer AdvancedLearnerStackPanel.Children.Add(frame1); }
// Fills the scroll viewer with Albums private void setupLayoutFrames() { CollectionFrame frame1 = new CollectionFrame(); BitmapImage src1 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[2].CollectionPicFileName)); Polaroid pol1 = new Polaroid(src1, this, MyDataList.instance.CollectionList[2]); pol1.CollectionTileImage.Name = MyDataList.instance.CollectionList[2].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol1); Grid.SetColumn(pol1, 1); Grid.SetRow(pol1, 1); // BitmapImage src2 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[1].CollectionPicFileName)); Polaroid pol2 = new Polaroid(src2, this, MyDataList.instance.CollectionList[1]); pol2.CollectionTileImage.Name = MyDataList.instance.CollectionList[1].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol2); Grid.SetColumn(pol2, 1); Grid.SetRow(pol2, 2); // BitmapImage src3 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[5].CollectionPicFileName)); Polaroid pol3 = new Polaroid(src3, this, MyDataList.instance.CollectionList[5]); pol3.CollectionTileImage.Name = MyDataList.instance.CollectionList[5].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol3); Grid.SetColumn(pol3, 1); Grid.SetRow(pol3, 3); // ////////////////////// // BitmapImage src4 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[0].CollectionPicFileName)); Polaroid pol4 = new Polaroid(src4, this, MyDataList.instance.CollectionList[0]); pol4.CollectionTileImage.Name = MyDataList.instance.CollectionList[0].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol4); Grid.SetColumn(pol4, 2); Grid.SetRow(pol4, 1); // BitmapImage src5 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[4].CollectionPicFileName)); Polaroid pol5 = new Polaroid(src5, this, MyDataList.instance.CollectionList[4]); pol5.CollectionTileImage.Name = MyDataList.instance.CollectionList[4].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol5); Grid.SetColumn(pol5, 2); Grid.SetRow(pol5, 2); // BitmapImage src6 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[6].CollectionPicFileName)); Polaroid pol6 = new Polaroid(src6, this, MyDataList.instance.CollectionList[6]); pol6.CollectionTileImage.Name = MyDataList.instance.CollectionList[6].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol6); Grid.SetColumn(pol6, 2); Grid.SetRow(pol6, 3); // ///////////// // BitmapImage src7 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[3].CollectionPicFileName)); Polaroid pol7 = new Polaroid(src7, this, MyDataList.instance.CollectionList[3]); pol7.CollectionTileImage.Name = MyDataList.instance.CollectionList[3].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol7); Grid.SetColumn(pol7, 3); Grid.SetRow(pol7, 1); // BitmapImage src8 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[7].CollectionPicFileName)); Polaroid pol8 = new Polaroid(src8, this, MyDataList.instance.CollectionList[7]); pol8.CollectionTileImage.Name = MyDataList.instance.CollectionList[7].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol8); Grid.SetColumn(pol8, 3); Grid.SetRow(pol8, 2); // BitmapImage src9 = new BitmapImage(makeAbsoluteUri(MyDataList.instance.CollectionList[8].CollectionPicFileName)); Polaroid pol9 = new Polaroid(src9, this, MyDataList.instance.CollectionList[8]); pol9.CollectionTileImage.Name = MyDataList.instance.CollectionList[8].CollectionPicFileName; frame1.CollectionFrameButtonGrid.Children.Add(pol9); Grid.SetColumn(pol9, 3); Grid.SetRow(pol9, 3); // ///////////// // AdvancedLearnerStackPanel.Children.Add(frame1); }