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
235
XamComboEditor inside a XamDatagrid (version 12.2)
posted

Hi, We want to be able to set the FieldSettings.EditorType of a field in the XamdataGrid to (Infragistics.Controls.Editors.XamComboEditor) instread of (Infragistics.Windows.Editors.XamComboEditor) because we want to take advantage of the multiselect feature. However, we are not being able to cast (Infragistics.Controls.Editors.XamComboEditor) to a ValueEditor. 

field.settings.EditorType = typeof (Infragistics.Controls.Editors.XamComboEditor); throws an exception.

Is there another way to do this in code?

I am attaching a sample project which demonstrates the issue.

XamDataGridMultiComboBox.zip
Parents
No Data
Reply
  • 34510
    Offline posted

    Hello Devaprem,

    The Infragistics.Controls.Editors.XamComboEditor is our shared combo editor.  Meaning that it works with both Silverlight and WPF.  This editor does not derive from ValueEditor so it cannot be used as an EditorType for a Field.  In order to use this editor you need to create a style on CellValuePresenter and then provide a template for the cell content.  Inside this template you would use the shared editor and bind it to the appropriate data.

    Based on the way your data is setup in the provided sample, I needed to write a Blend behavior that would take the Abilities from your PlayerData class and carry them over to the XamComboEditor.  A direct binding cannot be done because firstly XamComboEditor does not support binding to a collection of basic strings (IEnumerable<string>).  A complex type must be used.  Also, the XamComboEditor does not have a bindable SelectedItems property.  This is where the behavior comes in.  Inside the behavior I provide my own SelectedItems property which is meant to be bound to the PlayerData.Abilities property.  It then listens for selection change events on the editor and updates the PlayerData.Abilities appropriately.  It also supports going the other way.

    I have attached a modified version of your sample that contains the behavior code.  Let me know if you have any questions.

    XamDataGridMultiComboBox-updated.zip
Children