My Code is as follows
MainWindow.Xaml
<ListBox Width="400" Margin="10" x:Name="myListBox"
ItemsSource="{Binding Path=GridVal}" SelectedItem="{Binding CurrentItem}">
<ListBox.ItemTemplate>
<DataTemplate>
<Expander Header="Header1" IsExpanded="True">
<StackPanel>
<DataGrid
x:Name="dataGrid"
AutoGenerateColumns="False"
ItemsSource="{Binding Path=GridVal}"
Height="250" Width="250" SelectedItem="{Binding CurrentItem}"/>
</StackPanel>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>
MainWindow.Xaml
public object CurrentItem
{
get{return _item;}
set{_item=value;}
}
It displays a Listbox which has Expander and a Datagrid
I want to get the current selected row in datagrid which I am not able to get at this point.I am getting Datatemplate items instead of Datagrid