Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Binding pattern?
posted

My goal is to establish a datagrid that functions like a mini-spreadsheet, so my next question would be "is binding directly to the worksheet object a viable way of doing this?", or should I construct a middle-tier object graph that is responsible to managing visualization and binding to an underlying spreadsheet object? For example, assuming that I am able to successfully bind to the contents of a cell, would an edit of the contents automatically call the ApplyFormula method, or would I still need to handle this? 

I've tried to establish a pattern for binding the rows/cells of an excel worksheet object to a datagrid by directly binding to the Rows collection (myDataGrid.ItemsSource = myWorkSheet.Rows;), and this produces the right number of rows, but I'm having difficulting establishing the proper binding paths for the columns in my datagrid to properly bind to the contents of the cells.

For example, my attempt to bind to the Row index property looks like
Binding="{Binding Path=Index}"

and the binding I'm using for the cells (cell 0 in this example) is
Binding="{Binding Path=Cells, ElementName=0}"

but obviously this is not working (otherwise I wouldn't be writing =)

Thanks!

  • 8421
    posted

    Hello,

    To be able to display data from Excel it needs to be converted in to a form that the XamGrid can understand. I've attached a small sample that demonstrates loading and displaying Excel data, though please ignore all the places where I said things like "Load from XML" instead of "Load from Excel" :)

    This sample was designed in a way that it can load from an Excel file and have absolutely no prior knowledge of the structure of the data in Excel. Essentially, it allows you to load a dynamic number of columns.

    The limitations of this sample are that it only pulls in the value of the cell. While the Infragistics.Excel engine does have support for formulas, formatting, etc., there is no direct relation to the XamGrid. To have this functionality you'll need to implement some custom logic in your grid to apply that information.

    As we currently do not have this functionality in one of our controls I am going to be creating a private case for you and logging a new feature request for an Infragistics Excel Editor control.

    Please let me know if you have any further questions or concerns about this matter.

    ExcelDynamicColumns.zip