I am working on a local project and I have some issues.
I want to create a template for some results that have 3 strings(where 1 is a hyperlink) and a picture and they come as an ObservableCollection of results type binded to ItemSource.
public TestClass {
public string Title { get; set; }
public string Description { get; set; }
public string Link { get; set; }
public BitmapImage Thumbnail { get; set; }
}
So, I want to show those results in WPF and I want to use for each item a template and show them in a StackPanel (or ListView).
I tried with ListView but the only thing you can do is select the whole item, but I want also the link to be clickable.
My problem is: how can I create a template to use on each item and then add them in a list that 1 string is clickable?
As Unflux mentioned, that's a good way to do it. And as for the clickable link, use the
Hyperlink
control like I did below.and code-behind
results in
You will probably want to style it a bit and maybe apply a different
ItemsPanel
to really customize the look of your collection. You can also decorateItemsControl
with scrolling.