private void DisplayFeed(int day, SampleDataItem item, FlipViewItem selectedFlipViewItem) { TextBlock t; PanchangData pdata = item.GetPanchangData(_currentMonth, day); t = (TextBlock)FindNamedElement(selectedFlipViewItem, "SunriseTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Sunrise]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "SunsetTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Sunset]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "MoonRiseTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Moonrise]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "TamilYearTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.TamilYear]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "NorthYearTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.NorthYear]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "GujaratYearTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.GujaratYear]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "AyanaTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Ayana]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "RituTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Ritu]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "VedicRituTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.VedicRitu]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "TamilMonthTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.TamilMonth]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "SanskritMonthTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.SanskritMonth]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "PakshaTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Paksha]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "TithiTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Tithi]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "NakshatraTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Nakshatra]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "YogaTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Yoga]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "KaranaTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Karana]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "SunRasiTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.SunRasi]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "MoonRasiTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.MoonRasi]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "RahuKalamTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.RahuKalam]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "YamaKandamTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.YamaGandam]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "GulikaiTextBlock"); t.Text = pdata._fieldValues[(int)FieldType.Gulikai]; t = (TextBlock)FindNamedElement(selectedFlipViewItem, "FestivalTextBlock"); String festival = pdata._fieldValues[(int)FieldType.Festival]; if (String.IsNullOrEmpty(festival)) { festival = "No festival"; } t.Text = festival; }
private void Grid_Loaded_1(object sender, RoutedEventArgs e) { if (_initialized) { return; } List<Hadith> ahadith = GetAllHadithFromFile("Hadith.xml"); List<FlipViewItem> flipViewItems = new List<FlipViewItem>(); Random rand = new Random(); foreach (Hadith currentHadith in ahadith) { TextBlock mainTextBlock = new TextBlock(); mainTextBlock.Text = currentHadith.Narrator + "\r\n\r\n" + currentHadith.Content; mainTextBlock.TextWrapping = TextWrapping.Wrap; mainTextBlock.FontSize = 30; mainTextBlock.Foreground = new SolidColorBrush(Windows.UI.Colors.BlanchedAlmond); mainTextBlock.FontFamily = new FontFamily("Cambria"); mainTextBlock.Opacity = 0.9; FlipViewItem item = new FlipViewItem(); item.Content = mainTextBlock; // TODO: randomize order MainFlipView.Items.Add(item); } UpdateLiveTile(); _initialized = true; // Data bind //MainFlipView.ItemsSource = Ahadith; }