views:

56

answers:

1

Hi

I having trouble to manipulate CeLLs content in Silverlight Grids... I can get my DataGrid, the Columns but not the Cell value.

How can I get the first Cell wich is an Image in a Button for every row?? I can only achieve my goal by events like the button_click but not in regulare code behind.

thanks for help

+1  A: 

You can use DataGrid.SelectedItem property and cast record to your desired object.

Customer c = GrdCustomers.SelectedItem as Customer;
if (c != null)
{
    string customerId = c.CustomerID;
}

assuming you have your datasource as Customer.

KMan
DataGridViewCell.Value juste doesn't work in Silverlight.
Polo
@Polo: Thanks for pointing out. I have updated my response, let me know if this doesnt help.
KMan
DataGrid.SelectedItem is already cast as a XmlProduct in my project that isn't the problème.Let say for Product.ID == 1 i want to get the distinct row in my grid to change the little picture in Columns[0].Cell[0].Content. How can I do that?
Polo