AppStore.CategoriesPage.GridCategories_ContentChanging C# (CSharp) Method

GridCategories_ContentChanging() private method

Deals with populating categories in this page.
private GridCategories_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 ContainerContentChangingEventArgs args is a parameter called e that contains the event data, see the ContainerContentChangingEventArgs MSDN page for more information.
return void
        private void GridCategories_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));
        }