Saturday, February 28, 2015

DataTemplateSelector not being called

I finally found the answer. You will notice in my code that I override SelectTemplateCore:

Protected Overrides Function SelectTemplateCore(item As Object) As DataTemplate

But the function I was supposed to override was:

Protected Overrides Function SelectTemplateCore(item As Object, container As DependencyObject) As DataTemplate

Notice that the second one has a second parameter, so when I added the following to my selector:

Protected Overrides Function SelectTemplateCore(item As Object, container As DependencyObject) As DataTemplate
Return Me.SelectTemplateCore(item)
End Function

It worked! I thought you could override either one, but I guess not. At least it was a simple fix.



Nathan Sokalski njsokalski@hotmail.com http://ift.tt/1itfYLg


No comments:

Post a Comment