Hello,
how can I bind to id fields while showing assocciated display text fields in the grid?
I managed the grid view and editing by styles, but unfortunately this seems like a hack.While the grid displays what I want, as soon as I enable features like filtering or grouping, the underlying id data is displayed again.
I thought about completely remove id binding and bind direct to the display text columns.But this raises other issues. Only think about two different records with the same display text.The reverse mapping to the actual database record would be impossible.
So, is there any built-in support to do this without using workarounds?
Thanks.
Thank you for your reply. I am very glad that you have managed to fix the issue that you were having. Please le t me know if I can assist you with anything else
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Hi Krasimir,
meanwhile I went another way to fit my needs.It turned out that the approach from the thread Edit custom-object field using combobox selection in XamDataGrid works much better for me.
Thank you.
I am just checking if you require any further assistance on the matter.
Thank you for your reply and the modified sample. I have been looking into your scenario and in order to be able to change the display value of the cell that has no corresponding item in the ItemsSource of the XamComboEditro, what you can do is using the ValueToDisplayTextConverter property. You can create a class that derives from IValueConverter and in the converter to implement the logic for the values that are not in the list. You can check that by using the parameter of the Convert method, which is the XamComboEditor and check whether the SelectedItem property has a value. In order to be able to get the converter firing when the selected item is initialized, you can add an EventSetter for the Loaded event of the XamComboEditor and set the ValueToDispalyTextConverter in the event handler. I have modified the sample you have attached to shows how you can implement this approach.
Please let me know if you need any further assistance on the matter.
Hello Krasimir,
thank you for this sample, but I know this very well.In fact this was my first try at all to solve the problem.
As I wrote before, the combobox approach lacks in one situation.The data source of the combobox cannot contain all possible available users.
The real life application is much more complex and data intensive.The model contains ProjectGroups, each one containing thousands of Projects with each of them hundrets of sub-projects.I think you'll understand that I cannot load a million of records in the datasource of the combobox.In real life, for example the sub-projects combobox will only contain the records contained within the currently selected project within the same row.
But for making things easier, I've slightly modified the samle you provided.The user number 7 is not contained in the combobox, but it is displayed.I've added the UserName property as a separate column to make thinks clear.In fact, it should be only one column. But instead of the id 7 there has to be displayed User7.
So, the DisplayText binding must be assigned to the field directly.
Thank you for revisiting this thing.