Can you change a single cells editor/type in a single row at run time?
For example suppose that I have 2 columns and N rows of those columns
The first column is drop down that could be Bool, String, Number
Based on what the user selects in that column we would like to change the editor in column 2 for only that row (record I guess) to the appropriate editor.
If data were already in this row we would also like to replace it with a default value for the new type
Possible? If so could you provide a small sample?
Thanks
Hello Idistic,
Thank you for evaluating the Infragistics NetAdvantage for WPF tool set. I hope our toolset met your expectations.
This issue that you bring up in this post is definately possible. The xamDataGrid will allow mulitple editors in cells on a cell by cell basis. The first main thing to perform the task are these three lines below.
e.Record.Cells["Column_2"].EditorType = typeof(XamCheckEditor);e.Record.Cells["Column_2"].EditAsType = typeof(bool);e.Record.Cells["Column_2"].Value = false;
The first line tells the cell to use the XamCheckEditor. The second line tells the cell to choose the default editor for a boolean column, which is the xamCheckEditor. You should not have to use both lines, but I usually do anyway incase you want to specify a particular editor using the EditorType property. One situation is a double field might want to use the XamNumericEditor and another might want to use the XamCurrencyEditor. They are both edited as a double, but have different editors. Finally, the third line puts in a default value for the specific type.
Then, all you have to do is handle the correct events (InitializeRecord and RecordUpdated) to toggle the values on initial load and after you update a value.
I have provided a sample to show you how to achieve what you want. I hope I gave a good representation of what you need and I hope it helps to make your decision. Have a great day and if you have any other questions, please don't hesitate to post them.