I have a combobox in wpf that binds to a list. Everything works fine, but now for some reason I need to bind an element to a template. XAML for combo box
<ComboBox ItemsSource="{Binding Tracks}" SelectedItem="{Binding SelectedTrack}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding **WhatShouldBeHere**}"></TextBlock> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox>
If my data source is a user collection, then the binding is simple. I just need to pass the name of the property from the user collection, but as the binding source is a list of strings, which should be required.
c # data-binding wpf xaml combobox
MegaMind
source share