I tried XamComboEditorStyle, but it binds combobox to entire field. Whereas I want to bind Combobox only to currently selected cell.
Please help.
Thanks.
Priya
Hello Priya,
I am somewhat unsure of what you are asking here to be honest. Do you mean that you want the XamComboEditor to be in the cell that you click? Or do you want the value that is in the cell to show up in the xamComboEditor?
Sincerely,AndrewDeveloper Support IInfragistics Inc.www.infragistics.com/support
Hello Andrew,
Thanks for reply.
I want XamComboEditor to be applied to the Cell which I clickeda and not the column.
Whenever I click on another cell, this cell should look as Text field and that other cell should have Combobox.
Currently, It gets applied to entire field i.e. all the cells in clicked cell's column.
Thanks,
Hi Andrew,
Thank you again.
But it did not resolve my problem because As mentioned earlier, I have blank cells (from DataTable row which I bound to my XamDataGrid ) whose style I change to XamComboEditor in editModeStarting.
Is there any way to create a XamComboEditor style using Template and EditTemplate properties from code behind? Or is there any way in which I can use your code in edit mode starting to apply it to my selected cell?
I would not recommend setting the Editor in the Cell’s EditModeStarting event as it may be difficult getting the XamComboEditor to open, and you would have to handle the even EditModeEnding to get the XamComboEditor back to a TextEditor. Instead, I would recommend handling the CellValuePresenter’s PreviewMouseDown event, and set it there using a Style with a Trigger for IsInEditMode = true.
I have attached a sample demonstrating this being done in code-behind.
Please let me know if you have any other questions or concerns on this matter.
It is working fine now. Except for, on selecting item from ComboBox and clicking on another cell, it reverts the value.
How do I save new value in Template mode. I am trying to add binding for SelectedItemChangedEvent with no luck :(
xamDataGrid_CellUpdated and CellValuePresenter_PreviewMouseUp don't work either
To get the cell to retain the selected value from the XamComboEditor, you can handle the SelectedItemsChanged event of the combo editor and change the value accordingly based on what field the value was changed in. To get the field, make the CellValuePresenter variable a global variable so you can access it in the event handler.
Thanks for help. It is working as expected now.
Thanks a ton!!
In the constructor for the binding, you want the property name that you are binding to rather than the list’s name.
In the sample I had sent you, the binding was new Binding(“FoodType”){ } . In my data source, FoodType was a property in it, not the name of the collection.
If your data source itself is a List of chars, then the Binding will look like the following:
Binding B = new Binding(“Value”);B.RelativeSource = RelativeSource.TemplatedParent;
How do I set Binding for 'C' if I am using List of chars?
It is not recognizing anything if mention ListName in Binding like:
Binding C = new Binding("micrSymbols"); C.Source = CVP.Record.DataItem;
Here is an article about binding event handlers to FrameworkElementFactory elements : http://social.msdn.microsoft.com/Forums/vstudio/en-US/a79b62ce-ce36-4234-93d9-f2ed570176ff/frameworkelementfactory-addhandler.
However, I have found a better way to stop the reversion than handling the SelectedItemChanged event. Instead, I made a binding to the XamComboEditor.SelectedItemProperty. In the binding, it binds to the property name, and then the source is set to ((DataType)CellValuePresenter1.Record.DataItem).
I have attached a sample application demonstrating this.
How do I add SelectedItemsChanged event to Event Handler when I create XamComboBox like:
var XCE = new FrameworkElementFactory(typeof(XamComboEditor));
XCE.SetBinding(XamComboEditor.ItemsSourceProperty, new Binding() { Source = micrSymbols}); XCE.SetBinding(XamComboEditor.DisplayMemberPathProperty, new Binding("Value"));
Sorry to have so many questions as I am new to this technology.
Thanks in advance!
-Priya