contenttemplateselector

Why is the SelectTemplate Method run 2 times in debug mode?

Hello, debuging this class the SelectTemplate Method is run 2 times, but why? The first time the item is always null. public class PersonDataTemplateSelector : DataTemplateSelector { public override DataTemplate SelectTemplate(object item,DependencyObject container) { if (item is Person) { Person pe...

ContentTemplateSelector is only called one time showing always the same datatemplate

Hello, I have made a sample demo VS 2010 RC sample project, because in my production project I have the same error using MVVM. In my sample demo project I use only Code-behind without 3rd party dependencies so you can download the demo project here and run it for yourself: http://www.sendspace.com/file/mwx7wv Now to the problem: When ...

ContentTemplateSelector and Choose Template based upon the ListBoxItem Selected Item

Hi All, I have a XMLDataProvider Static Resource as for my Data listing some products. I have two Controls as Master Detail scenerio 1) ListBox which lists all the Product Titles and 2) COntentControl which displays the Product details. Now its working fine at the moment but the ContentControl is using a hard-coded Template. What I wa...

Changing ContentTemplate based on ListBox selection

Hi, I have a Listbox and a Border in a StackPanel similar to the following: <StackPanel Orientation="Horizontal"> <ListBox> <ListBoxItem Content="People"/> <ListBoxItem Content="Animals"/> <ListBoxItem Content="Cars"/> </ListBox> <Border Width="200> <ContentPresenter/> ...