views:

41

answers:

1

I would like to databind to a property that requires arguments.

What is the best way do to this? are there work arounds? I'm open to any suggestions.

I thought about defining custom columns and cells because the parameters that the property requires are available from the within the object bound to the row, but I'm having trouble materialising this idea.

As an additional problem, that I think leads on from this, I have also created a custom column and cell for the datagridview that takes the implementation of an interface during it's construction. I have added this column to the datagrid view programmatically (passing the Interface implementation to the column constructor). I've overridden the paint method which evaluates a property from the Interface implantation using arguments from the other rows in the column, but it doesn't seem to call the paint method at all. Even on DataGridView.Refresh(). Essentially I would like this column to also update, evaluate a property from the interface implentation using arguments from the underlying object bound to the row and print this number in the cell.

The reason for this second problem is so that I can implement the interface many different times and just at a column dynamically to display it's evaluation.

Thanks in advance for the help.

A: 

Quoted from the article linked below:

In .NET, controls can have many properties that can be bound to a DataSource. Each databound property has an associated Binding object. Since a control can have many Binding objects, the control has a collection (instance of ControlBindingsCollection class) of all the Binding objects. Also remember that different properties of the same control can be bound to different datasource's.

http://www.codeproject.com/KB/database/databindingconcepts.aspx

Hope that helps.

Tychumsempir