Enum Converter

How to convert the value of enum in Combobox when an item is selected. I want the selected item's value as a description of the enum.

1 Reply 1 reply marked as answer

BR Bharathi Rajakantham Syncfusion Team March 5, 2021 12:40 PM UTC

Hi Harsh, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked the reported query with the enum convertor. You can achieve your requirement using the EnumValuesExtension class. Please check the sample and the code snippet for your reference. 
 
Code Snippet: 
 
<syncfusion:ComboBoxAdv 
                Name="comboBox1" 
                Width="150" 
                ItemsSource="{local:EnumValues Type={x:Type local:Enum_Type}}" 
                SelectedValue="{Binding ComboBoxSelectedValue}" 
                 > 
                <syncfusion:ComboBoxAdv.ItemTemplate> 
                    <DataTemplate> 
                        <TextBlock Text="{Binding Converter={StaticResource EnumDisplayNameConverter}}"/> 
                    </DataTemplate> 
                </syncfusion:ComboBoxAdv.ItemTemplate> 
</syncfusion:ComboBoxAdv> 
 
 
 
 
Please let us know if you need any further assistance on this. we will be glad to assist you. 
 
Regards, 
Bharathi R 
 


Marked as answer
Loader.
Up arrow icon