OK... I am migrating from the agDataGrid (DevExpress) Silverlight control to Infragistics XamWebGrid. In my application using the devExpress grid, I have a button in each row that is bound to that row object. kind of confusing I know, but let me try to explain.... A recordset from the DB creates a list of objects, that list is bound to the Item Srouce of the grid becoming the rows, so the button within the row has a reference to that row object in its tag property. Now I can directly access the row object by casting the contents of the tag. This can be accomplished in the DevExpress grid by simply saying: <button x:name="foo" Tag="{Binding RowValue}"/>
My question is... is there any way to do this in Infragistics?
Thanks
Marc
Thanks again, I appreciate the help.
Hi Marc,
As far as Binding in the XamWebGrid is concerened, the trick to Binding is the DataContext.
The DataContext, is going to be the object that your binding is targeting. In a TemplateColumn of the XamWebGrid the DataContext is always going to the data for a specific row.
So if your data has a FirstName, and LastName property, you can target those properties specifically, by using the following syntax <TextBlock Text={Binding FirstName}/> which is the same as <TextBlock Text={Binding Path=Firstname}/>
Now, if you didn't specify a path, like: <TextBlock Text={Binding}/> then you're saying that it should bind directly to your data object, so the ToString of that object would wind up being displayed.
Here is a link that a quick google search with the terms "Binding in Silverlight" resulted:http://silverlight.net/learn/tutorials/databinding.aspx
Hope this helps.
-SteveZ
Yes, that worked... thank you very much....
Now another stupid question, one of the things in silverlight that has really bugged me is the whole binding thing. is there any GOOD documentation on binding, and what you can bind?
If i'm understanding you correctly. All you should need to do is create a TemplateColumn, put your button in the ItemTemplate property of the column, and for the tag property set it to a straight up binding.
<Button Content="Click Me" Tag={Binding} />