in SampleGallery/Pages/BaseCategoryPage.xaml.cs [31:69]
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Determine which category we're in
NavigationItem navItem = (NavigationItem)e.Parameter;
if(navItem != null)
{
// populate itemscontrols
// Featured samples
var result = from sampleDef in SampleDefinitions.Definitions
where (sampleDef.SampleCategory == navItem.Category)
&& (sampleDef.Featured == true)
select sampleDef;
FeaturedSampleControl.ItemsSource = result;
// Full sample list
result = from sampleDef in SampleDefinitions.Definitions
where (sampleDef.SampleCategory == navItem.Category)
select sampleDef;
FullSampleList.ItemsSource = result;
// Populate the featured-samples text
if (navItem.FeaturedSamplesTitle != "")
{
FeaturedSampleControl.Title = navItem.FeaturedSamplesTitle;
}
else
{
FeaturedSampleControl.Title = "Featured " + navItem.DisplayName + " Samples";
}
// Populate the category description textblock
var paragraph = new Paragraph();
paragraph.Inlines.Add(new Run() { Text = navItem.CategoryDescription });
CategoryDescriptionTextBlock.Blocks.Add(paragraph);
}
}