I am trying to create a listbox with 2 types of cells:
First with a 480X40 px picture and some text on top, to act as a section title.
Second a 480X80 px cell with background, 60X60 image, some text and an arrow.
So my question is how do I accomplish this?
I have thought of 3 solutions:
-
Define a Item Template witch contains all the items from cell 1 and 2 and show/hide the elements when biding.
-
Override the Biding method – this seems to be the correct method, but I have no idea how to do this.
-
Define 2 Item Templates outside the list box and create, bind and add them at runtime to either an ListBox or ScroolView.
Thank you.
Here is one approach http://www.windowsphonegeek.com/articles/Implementing-Windows-Phone-7-DataTemplateSelector-and-CustomDataTemplateSelector.
The other approach is to create two different templates and then have a text property on your item view model which contains the name of the template that should be used. You would then use a ValueConverter to convert from the text name to the actual template. You can see this described in detail here http://www.c-sharpcorner.com/Blogs/1937/.