I have this code that always display the default datatemplate even when the binding type seem to be LineRenderableSeriesViewModel.
<ListBox ItemsSource="{Binding ElementName=ACList, Path=SelectedItem.seriesViewModels, Mode=OneWay}" IsSynchronizedWithCurrentItem="True">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel.Resources>
<DataTemplate x:Key="Default" >
<Border BorderBrush="Red" BorderThickness="2" Background="Pink">
<TextBlock Text="{Binding}" Foreground="Red" FontWeight="Bold" Padding="5"/>
</Border>
</DataTemplate>
<DataTemplate x:Key="BindedTemplate1" >
<Border BorderBrush="Green" BorderThickness="2" CornerRadius="5">
<TextBlock Text="I'm asssociated to LineRenderableSeriesViewModel " Foreground="Green" FontWeight="Bold" Padding="5"/>
</Border>
</DataTemplate>
</StackPanel.Resources>
<!-- atempt to write type of object -->
<Label Content="{Binding}" ContentStringFormat="MyBindingType : {0}"></Label>
<!-- atempt to display the associated template -->
<ContentControl Content="{Binding}">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource Default}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding}" Value="LineRenderableSeriesViewModel">
<Setter Property="ContentTemplate" Value="{StaticResource BindedTemplate1}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
the display show rigth value of the viewmodel but it take default datatemplate
im not sure what hapen ?