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));
}