I have a grid that has two columns: Field and Value. Field never changes and is uneditable. Value can contain a number of different controls based on a configuration file all of which are custom implementations of standard controls such as the ComboBox, Textbox, Button, etc, and all of which are determined and created at runtime.
At some point my program is going to receive some data that needs to be programmatically populated into the Value column of each row, but the control that contains the value obviously has a different way of setting the "value."
My first question, however, is that given a reference to a grid in the code behind (in C#) how do I access the actual control object of the Cell of a given row? There appears to be no such collection as "this.myGrid.Cells" or "this.myGrid.Rows." I was thinking if I could access the value of each cell directly I could just have a large if statement to act accordingly based on the cell's content control type.
If that is not possible is there some way to bind, for example, the custom control's TextBox so that when I do something like:
this.myGrid.ItemSource = myDataTable; |
this.myGrid.Rebind(); |
the data in each cell of myDataTable is set in in the Text property of TextBox? Remember though, all this must be done programmatically.
Does this make sense? I really need help on this one. If you need further code examples of anything I have mentioned doing please let me know so I can provide them.
Thanks.