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. Image for the cookie policy date

Binding an Enum to a GridComboBoxColumn in UWP

I am struggling binding an enum to aGridComboBoxColumn.
Here is my data class:
public class MediaItem
public enum MediaItemType
public MediaItemType Type { get; set; }
public static List AllMediaItemTypes {
get {
return Enum.GetValues(typeof(MediaItemType)).Cast().ToList();
And my column constructor:
var typecol = new GridComboBoxColumn() {
MappingName = "Type",
HeaderText = "Type",
AllowEditing = true,
ItemsSource = MediaItem.AllMediaItemTypes
This mostly works. The menu is correctly populated, the MediaItem has its type set when an item is selected, and the value is shown in the cell after the menu item is selected.
But the cell will be blank if you navigate away.
I have played with SelectedValuePath and DisplayMemberPath, but these seem to only make things worse. I dseid try to express this in XAML as well, but struggled to find a way to provide the ItemsSource with the set of all enum values.
I am happy to use a XAML solution if that is easier. The WPF solution mentioned on the WPF forum does not work for UWP because it uses ObjectDataProvider. The attempt above is from trying to apply a UWP workaround I found for the missing ObjectDataProvider functionality.
Thanks for any help.

1 Reply

JG Jai Ganesh S Syncfusion Team November 14, 2016 12:30 PM UTC

Hi Duane, 
We have prepared a sample for binding Enum values to GridComboBoxColumn and it working fine in our end, 
public enum GetDetails 
var enumvalues = Enum.GetValues(typeof(GetDetails)).Cast<GetDetails>(); 
var typecol = new GridComboBoxColumn() 
    MappingName = "EnumType", 
    HeaderText = "EnumType", 
    AllowEditing = true, 
    ItemsSource = enumvalues.ToList() 
Could you please check the above sample and still if you are facing the issue, then please modify the above sample to replicate the issue? This would be more helpful for us to proceed further. 
Jai Ganesh S  

Live Chat Icon For mobile
Up arrow icon