1
Ich habe einige Probleme mit der Bindung von ContentControl an ListboxItem.Set DataTemplate von ElementName
Das ist meine ListBox.
<ListBox x:Name="box">
<ListBoxItem Tag="{x:Type vm:PART_FAMILY_ViewModel}" Content="Car"></ListBoxItem>
<ListBoxItem Tag="{x:Type vm:PART_TYPES_ViewModel}" Content="Bike" IsSelected="True"></ListBoxItem>
</ListBox>
Das ist mein ContenControl:
<ContentControl Content="{Binding ElementName=box, Path=SelectedItem.Tag}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:PART_FAMILY_ViewModel}">
<v:PART_FAMILYS_View></v:PART_FAMILYS_View>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:PART_TYPES_ViewModel}">
<v:PART_TYPES_View></v:PART_TYPES_View>
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
Mit meinem Elementname ich den Tag Datatype in meinem Content nur sehen.