Reputation: 42125
I have a list of viewmodels which have a boolean ShowIcon property. In the UI I'm planning to use a template binding that will hide or show an icon on each row, using this property.
However, there could be quite a few items in the list, so rather than just setting Visibility
on the icon, bound to the ShowIcon
property (probably using a ValueConverter
to convert bool
to Visibility.Hidden
) I'd like those row to actually have nothing where the icon would be.
That is to say it's a performance enhancement that I'm not even sure I'll need yet, but I suspect I will, so am asking the question in the hope of having the right answer if I find the UI is sluggish because of the sheer number of visual elements (or do I mean logical?) in the tree, even when they're hidden.
Upvotes: 2
Views: 248
Reputation: 311
Have you thought about using 2 different templates (one with and the other without image) and a DataTemplateSelector?
Upvotes: 4