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.
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.
Thanks for your sample. This works for me. However, this created a new problem. I was using the CellUpdated method of the xamDatagrid to to get notified when the value of the drop down was changed by the user (I then proceeded to persist the changes). However, since we are no longer using the field editor, the CellUpdated event does not get called when values are selected from the Abilities drop down. If there still a way to be notified in the CellUpdated event for this field? If not, which would be a comparable event on the control which I can use?
Also, is MultiSelect available on the a newer version of the Infragistics.Windows.Editors.XamComboEditor?
Hi Devaprem,
You'll have to use the SelectionChanged event on the XamComboEditor if you want to get notified when values change. As for MultiSelect being available on the WPF only XamComboEditor, currently the latest version of it does not support multi selection.
I recommend submitting this as a new product idea for the WPF combo editor. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.- Notifications whenever new information regarding your idea becomes available.- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.- Allow you to shape the future of our products by requesting new controls and products altogether.- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Let me know if you have any questions
Let me know if you have any further questions on this matter.
Hi Rob,
Thanks for your help.