Get the Value or content of Selected Row of Gridview in WPF

Posted by Syedshakeer under WPF on 10/18/2010 | Points: 10 | Views : 8882 | Status : [Member] | Replies : 1
Hi,
I had created a GridView using ListView and Binded data in it.How i can get the value (or)Content of SelectedRow of a Particular Column in Gridview.

Below is code xaml code.

<ListView ItemContainerStyle="{StaticResource CustomListViewItemStyle}" AlternationCount="2" BorderBrush="Black" BorderThickness="0" Name="listviewRecentHistory" ItemsSource="{Binding}" Height="Auto" Width="880" HorizontalAlignment="Left" Background="Transparent" SelectionChanged="listviewRecentHistory_SelectionChanged">
<ListView.View>
<GridView>

 <GridViewColumn Width="60" Header="Job Id">
<GridViewColumn.CellTemplate>
<DataTemplate >
<Label>
<Hyperlink Cursor="Hand" Click="hyperlink_Click" >
<TextBlock Name="text" Text="{Binding JobID}" ToolTip="{Binding BatchID}">


</TextBlock>
</Hyperlink>
</Label>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>


Syed Shakeer Hussain


Responses

Posted by: Abhi2434 on: 10/18/2010 [Member] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Well,

If you make IsSynchronizedWithCurrentItem to true, the CollectionView will hold the Current item in context. See my article on CollectionView, I did the same thing :

http://www.abhisheksur.com/2010/08/woring-with-icollectionviewsource-in.html

I hope this would help you.

www.abhisheksur.com

Syedshakeer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response