Thursday, 19 September 2013

How to define a ItemTemplate for GridView (inside a ListView) so it can be used mu different ListView?

How to define a ItemTemplate for GridView (inside a ListView) so it can be
used mu different ListView?

The question is quite straightforward but I just can't neither find an
example nor figure it out by myself.
My requirement is I have some ListView, which bind to some collections in
the ViewModel. The type of items in those collections are the same (let's
called TypeA), which is a class exposing multiple simple type properties.
So I would like to display them in a GridView inside those ListView. And
naturally I would want to define a DataTemplate for this TypeA, so that I
don't need to write the same long xaml code, because I have for example
many header properties defined for the GridViewColumn. All of the examples
are to define the ItemTemplate inside the ListView. How can I make a
resource and let different ListView refer to this resource?

No comments:

Post a Comment