Skip to content

DataTemplate Selectors in Collection views #180

Closed Answered by brminnick
roughiain asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @roughiain!

Are you looking for help creating a DataTemplateSelector using C# Markup? Here's an example of how to do it from my app, GitTrends: https://github.com/brminnick/GitTrends/blob/main/GitTrends/Views/Repository/RepositoryDataTemplateSelector.cs

Or are you asking how to add a DataTemplateSelector to a CollectionView using the C# Markup Extensions? You do it the same way you would do it for a DataTemplate:

new CollectionView()
  .ItemTemplate(new MyDataTemplateSelector());

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@roughiain
Comment options

Answer selected by roughiain
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants