Hi..I am using Listview for display data.it works fine.
But i want the listview selected item value in one variable.i m trying to retrieve using selectedvalue property.but its taking null value.
if the user selects one cell value in the listview then he clicks the button then tat value sholud be displayed in messgebox.
can u suggest some answer for this.
My listview is as shown below.
<ListView ItemsSource="{Binding}" x:Name="ListView1"
DisplayMemberPath="{Binding}"
DataContext="{Binding Source={StaticResource BookProvider1}}"
IsSynchronizedWithCurrentItem="True" Margin="369,135,38,46">
<ListView.ItemContainerStyle><Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<EventSetter Event="GotFocus" Handler="Item_GotFocus" />
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Header="BookID" Width="100" x:Name="Col"
DisplayMemberBinding="{Binding Path=BookId,Mode=OneWay}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=BookId,Mode=OneWay}"
Margin="-6,0,-6,0"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="BookName" Width="100"
DisplayMemberBinding="{Binding Path=BookName,Mode=TwoWay}">
<TextBox Text="{Binding Path=BookName,Mode=TwoWay}"
<GridViewColumn Header="BookDescription" Width
="200"
DisplayMemberBinding="{Binding Path=BookDesc,Mode
=TwoWay}">
<TextBox Text="{Binding Path=BookDesc,Mode=TwoWay}"
</GridView>
</ListView.View>
</ListView>
Please how to retrieve this listview selected value ..because here in listview i m placing gridview.
how to select that gridview cell selected value..
Please give answer for this..because i m new to wpf..
Thanks in advance..
Hello GDU,
For Microsoft controls, you can get most of your answers on MSDN:
For ListView:
http://msdn.microsoft.com/en-us/library/system.windows.controls.listview.aspx
For GridView:
http://msdn.microsoft.com/en-us/library/system.windows.controls.gridview.aspx
I would recommend using our XamDataGrid instead of the GridView. On the XamDataGrid, I believe the ActiveCell property would get you the value you needed.