AppStore.MainPage.GridFeaturedCategories_ContentChanging C# (CSharp) Method

GridFeaturedCategories_ContentChanging() private method

Deals with populating categories in the Featured-Categories section.
private GridFeaturedCategories_ContentChanging ( ListViewBase sender, ContainerContentChangingEventArgs args ) : void
sender ListViewBase Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.
args ContainerContentChangingEventArgs EventArgs args is a parameter called e that contains the event data, see the ContainerContentChangingEventArgs MSDN page for more information.
return void
        private void GridFeaturedCategories_ContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            args.Handled = true;
            if (args.Phase != 0)
            {
                throw new Exception("Not in phase 0.");
            }
            Categories category = (Categories)args.Item;
            Grid templateRoot = (Grid)args.ItemContainer.ContentTemplateRoot;
            Image categoryIcon = (Image)templateRoot.FindName("categoryIcon");
            TextBlock categoryName = (TextBlock)templateRoot.FindName("categoryName");
            categoryName.Text = category.Name;
            categoryIcon.Source = new BitmapImage(new Uri(category.Background));
        }