The following code illustrates two methods of obtaining the contents of a DataGrid Item. The function has been bound to the ItemCommand of the DataGridCommandEventHandler. It is invoked by clicking a button within the row.
Note that because I am loathe to hard-code column numbers, as they may change, I at least make the code a bit easier to maintain by setting constants to represent the column numbers I need to use.
In the first example, I get the Address by simply using the Text attribute of e.Item.Cells.
In the second example, which is the more common in the documentation, I use the two-step process of obtaining the object, e.Item.Cells.Columns as a TextBox, and then getting its Text attribute.
QUESTION: Why is the second example more common in the documentation when the first method seems to work, is easier to code, and is faster?
QUESTION: Am I missing something terribly important here?