views:

629

answers:

1

In silverlight app, I have a datagrid with image as first column (please see the code below that I am using)

when I click on the image I am capturing MouseLeftButtonDown event, the problem I am running under is that while clicking on the image the SelectedIndex in the Datagrid is not changing Hence I don't know which row was clicked.

<data:DataGridTemplateColumn Width="25">
    <data:DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <Image Width="20" Stretch="Fill" Name="Delete"  Source="/Portal;Component/Images/Delete.png" MouseLeftButtonDown="ImageDelete_MouseLeftButtonDown"/>
        </DataTemplate>
    </data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
A: 

Are you setting e.Handled to true in you event handler per chance? If so then the data grid will not see the mouse down event.

AnthonyWJones
Event is getting fired, but when I output MyDataGrid.SelectedIndex, I am getting index of the previously selected column and not the one on which image was click,
Raj
Are you setting handled to true?
AnthonyWJones
nope, not setting it to true
Raj