Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
XamComboEditor not binding to column value
posted

I have the following code:

 fls.EditorType = typeof(XamComboEditor);

 

Style styleComboEditor = new Style(typeof(XamComboEditor));

 

Binding bind = new Binding() { Source = EnumHelper.GetList(enumType) };

bind.BindsDirectlyToSource =

true;

styleComboEditor.Setters.Add(

new Setter(XamComboEditor.ItemsSourceProperty,bind));

styleComboEditor.Setters.Add(

new Setter(XamComboEditor.IsEditableProperty, true));

styleComboEditor.Setters.Add(

new Setter(XamComboEditor.DisplayMemberPathProperty, "Value"));

styleComboEditor.Setters.Add(

new Setter(XamComboEditor.ValuePathProperty, "Key"));

fls.EditorStyle = styleComboEditor;

 My enum looks like this:

 

 

 

public

 

 

enum

SecurityLevel

{

Administrator = 0,

[

 

Description("General User"

)]

GeneralUser = 5,

[

 

Description("Read-Only"

)]

ReadOnly = 9,

}

The values appear in the drop down.  but the actual value in the column is still the original value from the database.  What am I doing wrong?

Thanks,

Linda Rawson

 

  • 54937
    Offline posted

    From the snippet provided I cannot tell what your items coming from your GetList method are returning. It would appear that you must be returning an object where the database value is stored in a property of the item named Key and the value you want the end user to see is stored in a property of the item named Value but then that should be working. Can you provide a functional sample that demonstrates the issue?