Question

I have a list of objects (same class). Each of these objects has couple of properties. I would like to build a GUI that would show a "tile" for each of these objects and in this "tile" the property values of this object would be displayed. The image bellow illustrates the idea.

enter image description here

By pressing on the + tile it would be possible to add new object (would bring up the dialogue). The object tiles would wrap to the next line allowing X tiles per line.

What would be your suggestions to do this in a civilized manner to be able to automatically add/remove tiles as an object in the list is created/deleted? Maybe someone knows some examples?

Currently I'm quite blank on how to achieve this.

Was it helpful?

Solution

Consider using some sort of ItemsControl with a DataTemplate. I would review the follow tutorial on how to do that: http://wpftutorial.net/DataTemplates.html


As Matt Burland stated, you will need to put your objects into a ObservableCollection for them to appear "dynamically".

OTHER TIPS

1) Use a ListBox, bind ItemsSource property to your List. 2) Insert whatever kind of object you like in that list. 3) Create DataTemplate for each kind of object to display

Please refer to this post -

WPF toolkit for tile listview

it outlines using a ItemsControl with wrap panel create a tile effect. Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top