Users Pricing

forum

Home Forums How to access row data from a MouseLeftButtonDown event on a textblock, in a gridview – MindStick

How to access row data from a MouseLeftButtonDown event on a textblock, in a gridview

Anonymous User 2643 25 Sep 2013

I am trying to modify data in rows in a gridview which I have pulled from a database.

The data is being bound to each gridview column like the following.

<GridViewColumn Header="Status" Width="120" util:GridViewSort.PropertyName="Status">

    <GridViewColumn.CellTemplate>

        <DataTemplate>

            <TextBlock Text="{Binding Path=Status}" FontWeight="Bold" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown_1"/>

        </DataTemplate>

    </GridViewColumn.CellTemplate>

</GridViewColumn>

I have a MouseLeftButtonDown event on the textblock, and this fires when I click on the specific text.

                                       

private void TextBlock_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)

{

    MessageBox.Show("Hello");

}

The issue I am having is that I can't find a way to access the row data(such as the id, or the text in the row).

Is there any way to access all the row data from within the click event?

Thanks


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md