We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WPF enables specifying DataTemplates to be selected based on the binding type.
DataTemplate
This can be implemented as following:
<ItemsControl ItemsSource="{Binding Coll}"> <ItemsControl.Resources> <DataTemplate DataType="{x:Type local:ClassOne}"> <Rectangle Width="50" Height="50" Fill="Red" /> </DataTemplate> <DataTemplate DataType="{x:Type local:ClassTwo}"> <Rectangle Width="50" Height="50" Fill="Blue" /> </DataTemplate> </ItemsControl.Resources> </ItemsControl>
The ItemsControl will automatically resolve the correct DataTemplate according to the matching DataType.
ItemsControl
DataType
DataTemplateSelector
The text was updated successfully, but these errors were encountered:
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Sorry, something went wrong.
WOW! I can't believe I forgot I opened the very same issue 5 years ago! Yup same issue indeed, gonna close.
No branches or pull requests
Proposal: Support implicitly typed DataTemplate like WPF
Summary
WPF enables specifying
DataTemplate
s to be selected based on the binding type.This can be implemented as following:
The
ItemsControl
will automatically resolve the correctDataTemplate
according to the matchingDataType
.Rationale
DataTemplateSelector
Scope
DataTemplate
s by their typeImportant Notes
Open Questions
The text was updated successfully, but these errors were encountered: