Telerik RadComboBox ItemTemplate and MultipleSelectionBoxTemplate

0 Answers 25 Views
ComboBox
ARASH
Top achievements
Rank 1
ARASH asked on 16 Aug 2022, 10:15 AM

how can I specify MultipleSelectionBoxTemplate which i can access properties of selected items ?

i have an employee class 

    public class Employee {
    public string Firstname {get;set;}
    public string Lastname {get;set;}
    }



I am using Telerik radCombobox in my wpf application to display list of employee 

              <telerik:RadComboBox x:Name="radComboBox"
                                     Width="200" 
                                     AllowMultipleSelection="True" 
                                     ItemsSource="{Binding Path=EmployeeList}"  
                                     >

                    <telerik:RadComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=Lastname}" />
                        </DataTemplate>
                    </telerik:RadComboBox.ItemTemplate>

note: this code simplified , i have to use ItemTemplate  because i set textblock style based on some condition 


this works fine for item template  but when i select an item the display text in combobox show  full name of Employee class (namespace + class name ) not the Lastname
i tried 

             <telerik:RadComboBox.MultipleSelectionBoxTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=Lastname}" />
                        </DataTemplate>
                    </telerik:RadComboBox.MultipleSelectionBoxTemplate>


i get no result , the combobox displayvalue of selected item is always empty.

i tried another solution 

                    <telerik:RadComboBox.MultipleSelectionBoxTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=SelectedItems,Converter={StaticResource SelectionToCustomStringCoverter}}" />
                        </DataTemplate>
                    </telerik:RadComboBox.MultipleSelectionBoxTemplate>

this neither work , the converter always execute at first selection 

this is really crazy spending 4 hours to figure out a simple thing , 
so my question is how can i specify MultipleSelectionBoxTemplate which i can access properties of selected items .



  

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
ARASH
Top achievements
Rank 1
Share this question
or