Hi there,
I use a XamComboBox in my XamDataGrid so I can use the multiple selection function. So far everything works just fine and I can select my objects but when I set RecordContainerGenerationMode to "Recycle", the recycling produce some wrong CellValuePresenterStyle that doesn’t refresh himself correctly. So I get wrong values after scrolling up and down. If I use any other GenerationMode, the performance of the DataGrid is not useable for the end-user.
As far as I know, you have to use the XamComboBox form the Editors assembly to use the multiple selection functionality. So my first question is, is that true or is there another way that I can use XamDataGrids comboBox with multiple selections?
Or is there a solution that I don’t get the refresh problem with my CellValuePresenter?
BR
Andreas
Hi Andrew,
Thank you again for your help, it really sounds a little bit strange but luckily I just have to use the theme property for prototyping and besides that you also provided a working solution for this behavior.
So from my point all my problems are solved.
Hello Andreas,
After some debugging, it strangely appears that this exception is actually coming from the Theme property being set on the XamDataGrid, and it is causing an error with the SelectedItems collection changing in the XamComboEditor that is placed in the CellValuePresenter control. I tried to reproduce this issue by creating a new XamDataGrid sample which has no difference except the structure of the data source, and I was not able to reproduce this issue. I am not entirely sure why this exception is happening due to the Theme property being set, and I am speaking to our development team for guidance on this issue.
For the time being, I have devised a workaround for you to this issue. Rather than utilizing the Theme property on the XamDataGrid, I would recommend implementing the default styles for your desired theme into the XamDataGrid, by using a merged resource dictionary. A common directory to find these default styles is C:\Program Files (x86)\Infragistics\2014.2\WPF\DefaultStyles\DataPresenter.
I have attached a modified version of the sample you sent to merge the 14.2 default styles for the IGTheme into the XamDataGrid. I will update this forum thread again when I receive a response from our development team on this issue.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.Infragistics.com/support
First of all, thank you and your colleagues for your help, what a strange behavior. I just implemented your solution into my project and it works like a charm.
But now I’m facing a minor error, it occurs when I close my Window with this solution. I modified the solution so you can reproduce this error, you only have to close the window with the grid.
After a bit of research and conversing with my colleagues about this issue, I believe we have found a solution for you on this. It appears that the SelectedItems binding is not being set at all from the Style on the CellValuePresenter. I am unsure why this is, since there are no binding errors being thrown and logically, the binding makes sense.
The solution I have come up with is to handle the Loaded event on the XamComboEditor in the CellValuePresenter style and set the binding on its SelectedItems property from code. Along the way, you will need to make a few checks to make sure that the DataRecord, ParameterUi item, and ParameterUi.Self.SelectedSaIds are not null, because the first time through this Loaded event, they will be null. When those three are not null, set the binding using BindingOperations.SetBinding(DependencyObject d, DependencyProperty prop, BindingBase binding);
I have attached a modified version of the sample you sent to demonstrate the above.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Hello Andrew,
Thank you for your response. I’ve looked into both of your suggestion and I could reproduce in both cases my own problem, this happens when I set the amount of rows to about 1000 and activates the immediate scrolling mode. In this case the displayed values don’t necessary match their real values when you scroll through the grid, so the refreshing doesn’t work properly. As far as I can see, the second link only store 1 item but can shows n items in the grid.
I just figured out that my Binding on SelectedItems isn’t working like I would use it in a normal case. So I init my rows with two preselected Items but I don’t see these information in my grid. Is there a way to make my prototype working?
I just added my approach with how I add a normal XamComboEditor with Binding on SelectedItems.