We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding enum to SfDatagrid GridComboBoxColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

119868 Aug 8,2015 03:50 PM UTC Aug 10,2015 08:17 AM UTC WPF 1
loading
Tags: SfDataGrid
Rahulan
Asked On August 8, 2015 03:50 PM UTC

How can I bind an enum to SfDatagrid GridComboBoxColumn?
Example :

public enum Gender
{
Male,
Female
}

I need to display values 'Male' and 'Female' in the combobox  using MVVM.

Jai Ganesh S [Syncfusion]
Replied On August 10, 2015 08:17 AM UTC

Hi Rahulan,

Thank you for contacting Syncfusion Support.

We have analyzed your query. You can bind the enum to SfDatagrid by using “ObjectDataProvider class.


Code Snippet [XAML]:


<Window.Resources>

        <ObjectDataProvider x:Key="enumdata" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">

            <ObjectDataProvider.MethodParameters>

                <x:Type TypeName="local:Gender" />

            </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

</Window.Resources>


<Syncfusion:GridComboBoxColumn MappingName="EmployeeGender" ItemsSource="{Binding Source={StaticResource enumdata}}"/>


We have also prepared the sample based on this and please find the sample under the following location,


Sample: http://www.syncfusion.com/downloads/support/directtrac/141092/ze/SfDataGridComboBoxDemo-738189882


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;