I use a datatemplate to render some elements in a ComboBox, ItemsSource is bound to an ObservableCollection. To keep it simple, let me say that I put people in an ObservableCollection:
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
}
My DataTemplate looks like this:
<DataTemplate TargetType="{x:Type Person}">
<StackPanel Orientation="Horizontal">
<TextSearch.Text>
<MultiBinding StringFormat="{} {0} {1}">
<Binding Path="FirstName"/>
<Binding Path="LastName"/>
</MultiBinding>
</TextSearch.Text>
<TextBlock Text="{Binding FirstName}" Margin="2,0" />
<TextBlock Text="{Binding LastName}"/>
</StackPanel>
</DataTemplate>
ComboBox, person. , TextSearch.TextPath ComboBox, TextSearch.Text-Property ComboBoxItem DataTemplate.
, ( MultiBinding StringFormat, Snoop), StackPanel, , Snoop ( ), , , ComboBoxItemTemplate, .. , , ComboBoxItem StackPanel. TextSearch.Text , ComboBoxItem, - .
:. TextSearch.Text-Property DataTemplate ComboBoxItem, XAML-Styles -Control-Templates?
ControlTemplates ComboBox ComboBoxItem (Item-) DataTemplate, -Behind , , . , . , , TemplateBinding RelativeSource-stuff...
, , - , . , "" , " " , .
?