Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView GroupHeaderTemplate in code forcing a custom ViewCell type

$
0
0

Going through the [https://github.com/jamesmontemagno/Xamarin.Forms-Monkeys](Monkey demo) on code-based ListView generation, trying to get a header cell to show up via code, the example creates a custom ViewCell:

public class HeaderCell : ViewCell {
    public HeaderCell() {
         // Build cell
    }
}

If I take the contents of the HeaderCell ctor and place it in a DataTemplate initializer in the code behind:

list.GroupHeaderTemplate = new DataTemplate(() => {
    return new ViewCell {
        // contents of the HeaderCell ctor
    };
});

Then no group headers show up at all. Any ideas?


Viewing all articles
Browse latest Browse all 58056

Trending Articles