Inheritance: Panel, IVariableSizedWrapGrid
 private static void ResetGrid(VariableSizedWrapGrid grid)
 {
     grid.Children.Clear();
     var itemsSource = GetItemsSource(grid) as IEnumerable;
     if (itemsSource != null)
     {
         DataTemplate template = GetItemTemplate(grid);
         foreach (var item in itemsSource)
         {
             UIElement child = (UIElement)template.LoadContent();
             FrameworkElement element = child as FrameworkElement;
             if (element != null)
             {
                 element.DataContext = item;
             }
             grid.Children.Add(child);
         }
     }
 }
 public static void SetItemsSource(VariableSizedWrapGrid obj, object value)
 {
     obj.SetValue(ItemsSourceProperty, value);
 }
 public static void SetItemTemplate(VariableSizedWrapGrid obj, DataTemplate value)
 {
     obj.SetValue(ItemTemplateProperty, value);
 }
 public static DataTemplate GetItemTemplate(VariableSizedWrapGrid obj)
 {
     return (DataTemplate)obj.GetValue(ItemTemplateProperty);
 }
 public static object GetItemsSource(VariableSizedWrapGrid obj)
 {
     return obj.GetValue(ItemsSourceProperty);
 }
 private void ThumbnailGrid_Loaded(object sender, RoutedEventArgs e)
 {
     _thumbnailGrid = (VariableSizedWrapGrid)sender;
     ResetThumbnailGrid();
 }