WPF: change DataTemples according to Value
Posted
by Kave
on Stack Overflow
See other posts from Stack Overflow
or by Kave
Published on 2010-04-25T00:21:52Z
Indexed on
2010/04/25
0:23 UTC
Read the original article
Hit count: 337
I have a class called Cell with two properties. One is called Value of type int? And the other is called Candidates of type ObservableCollection>
during the initialization I am utilizing a DataTemplateSelector to choose between two datatemplates for two different scenarios.
If the Value property has a value then template A should be used to present the Cell class. However if the Value property is null Then template B should be used to present the Cell class.
While this works perfectly fine during the initialization however during the runtime the templates don't change any more when the value of the Value property actually changes.
Is the approach of using DataTemplateSelector the wrong approach to change DataTemplates dynamically? What would you recommend I should do?
Many thanks,
© Stack Overflow or respective owner