Hi,
I have a Telerik combo box bound to a list of items. It displays them fine. All I wish to change is to append a property of another object to the start of the string in the combobox.
Currently, the combo box shows "ListOfItems.Name", I would like it to show "Object.Property --- ListOfItems.Name"
<telerik:RadComboBox x:Name="radComboBox" ItemsSource="{Binding ListOfItems}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedName, Mode=TwoWay}"/> Something along the lines of
<telerik:RadComboBox x:Name="radComboBox" ItemsSource="{Binding ListOfItems}" DisplayMemberPath="String.Append(Object.Property --- Name)" SelectedItem="{Binding SelectedName, Mode=TwoWay}"/> How can I do this in my XAML code ?
Answer: 1
I am not entirely sure I understand what it is you want to do, but if I have understood correctly you have to use the ItemTemplate property of the RadComboBox:
<telerik:RadComboBox x:Name="radComboBox" ItemsSource="{Binding ListOfItems}" SelectedItem="{Binding SelectedName, Mode=TwoWay}"> <telerik:RadComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="Object.Property"></TextBlock> <TextBlock Text=" --- "></TextBlock> <TextBlock Text="{Binding Name}"></TextBlock> </StackPanel> </DataTemplate> </telerik:RadComboBox.ItemTemplate> by : Henrik Söderlundhttp://stackoverflow.com/users/250605
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog