You explained what your application is, but you didn't ask a question. Please state the question, and I can try to give you a better answer.
My best guess is "how do I do that? Do I need to write a custom control?" If that is what you are asking, you probably don't.
Usually you don't need a custom control to make a specialized view for a listbox, listview, or gridview. You can often use data templates, control templates or styles to achieve what you are looking for.
I am not sure if this is a good resource, but the XAML looks like it may be a good starting point for learning how to do control templates:
http://ligao101.wordpress.com/2007/07/27/customizing-listview-in-wpf-part-i/
Simply googling for any of those terms ("ListView data template", etc) will probably get you some good information.
Edit:
From the comments, you are trying to support one of two types of data in the same space in the UI, depending on what is in your XML file:
- Image Only
- Image, plus two lines of text
One way to solve this would be to create a view model for your XML items, and bind the items to those view models:
public class XmlItemViewModel // Call this something more appropriate to your app
{
public Visibility TextVisibility { get; set; }
public string Text1 { get; set; }
public string Text2 { get; set; }
public Image Picture { get; set; }
}
If you already have a different class that has this data, keep it, and make the view model read properties off that class.
Bind the XAML TextBlock Visibility property to "{Binding TextVisibility}", and it should work. If you set the viewmodel property "Visibility.Collapsed", the text blocks will go away, and your ViewBox should shrink to fit only the image.
If you do this, you don't need a custom control, just a custom ViewModel class.
If it doesn't seem to collapse correctly, you could wrap your image and text blocks with a StackPanel or WrapPanel.