Hello,
is possible reference parameter to cell in xamSpreadSheet? I have list of custom class with values from database and i would like to write these values into sheet and on save function write back to database.
Simply solution will be, if i have any parameter like public string Value { get; set; }, i reference it to specific cell, for example Rows[1].Cells[1] and after that, if i change this cell in SpreadSheet as user, automatically will be change parameter Value.
Or, what is best solution to this problem?
Thank you a lot!
Hello Martin,
I have been investigating into this, and it sounds to me like you are trying to bind a WorksheetCell's Value to an external, "Value" property on one of your objects, or be able to map that cell's value to that object. Unfortunately, if this is the case, this does not seem to be possible as the WorksheetCell.Value is not a DependencyProperty and as such, cannot be bound.
If you would like to achieve this, I would recommend instead that you perhaps handle the XamSpreadsheet's ActiveCellChanged event. In this event handler, you can get the e.OldValue to get the previously active WorksheetCell. In doing this, if you keep a "collection" of the mappings that you are looking to achieve, you can compare this cell's worksheet address against your mappings and compare the Value of this cell against the mapped value in this event. If they differ, you can set your property's value to the value of the cell.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Ok, sounds like good idea, but what if i use changed event on hundreds of cells? Have you please idea, what this will have effect to performance of whole XamSpreadsheet performance? I must found best solution to store hundreds of cells from spreadsheet to database and this solution must be most effective.
I cannot say I'm entirely sure I completely understand the exact functionality you are looking to achieve in this case...
In order to push your database information to the XamSpreadsheet, you will need to create a Workbook and Worksheet object from it, as described here: https://www.infragistics.com/help/wpf/spreadsheet-adding. When you make changes in the XamSpreadsheet, those changes will be pushed back to the corresponding WorksheetCell.Value, which you can obtain by looping through the Worksheet.Rows collection, and then the Cells collection of each of the rows. As such, I feel that you should just be able to push your information back to your database using the Worksheet objects that exist in your Workbook?
If my impression of the functionality that you are looking to achieve in this case is incorrect, would it be possible for you to please elaborate a bit further on the exact functionality you are looking for in this case?
I have project where are large tables with data. See this video from one of project part on https://www.youtube.com/watch?v=cjRYEWGgQuk . But for last few months i deal a performance with DataGrid controls from other developers and now with Infragistics. All with no ideal results.
Now i turn to Spreadsheet control like the best solution of this problem. But before i start with rebuilding whole project, i must found best practice to load data from database into spreadsheet and save them back. We speak about more than eighty columns with apr. 62 rows, therefore the solution must be simplest to load, to save.