0

I'm looking for a solution to bind a List<customclass> to a ListView (or GridView?), where I can modify the way how the items are displayed, for example, the customClass has a name and a picture and I want to display at the left half of the row in the listview the picture and on the right half the text in a textblock.

Is this possible? If yes, how/where should I start? I'm very new at WPF/XAML so it is very hard to understand how data binding and this stuff works.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
student96
  • 345
  • 1
  • 4
  • 14
  • 1
    this is my example http://stackoverflow.com/questions/35781205/dynamic-path-icon-buttons-in-a-collection-itemtemplate-resource-w-mouseover/35800805?noredirect=1#comment59643321_35800805 – tCoe Jul 22 '16 at 17:22
  • Do you mean I should use a Itemscontrol instead of a ListView? – student96 Jul 22 '16 at 17:57
  • works really well in my application, I am able to have all my buttons created dynamically and disable them dynamically based on connection status(you could use whatever you want for that). – tCoe Jul 22 '16 at 18:02
  • 1
    but how do I get the clicked/touched item of a ItemsControl? I generate for each item a button, but how do I know which button/index it is? – student96 Jul 22 '16 at 18:55
  • 1
    ok I found out by myself, the easiest way to check which button was clicked is to add an onClick Event in button definition and set as content a textblock with the correct name. This name can be read with this line: ((sender as Button).Content as TextBlock).Text – student96 Jul 22 '16 at 19:45

0 Answers0