Hi i have problem with accessing hidden value in DataGrid
of selected Row
:
<DataGrid Name="grid" ItemsSource ="{Binding}" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Id_user" Binding="{Binding id_user}" Visibility="Hidden"/>
<DataGridTextColumn Header="A" Binding="{Binding A}" />
<DataGridTextColumn Header="B" Binding="{Binding B}" />
</DataGrid.Columns>
<DataGrid.ItemContainerStyle>
<Style TargetType="DataGridRow">
<EventSetter Event="MouseDoubleClick" Handler="selectRow"/>
</Style>
</DataGrid.ItemContainerStyle>
</DataGrid>
This is code witch I use to do that, but I got that element doesnt exist.
private void selectRow(object sender, RoutedEventArgs e)
{
DataRowView row = (DataRowView)grid.SelectedItems[0];
var x = row["Id_user"];
this.NavigationService.Navigate(new PageA((string)x));
}
Is there a simply way to do that?
EDIT:
row["ID"]
is not SelectedItem.id
. This is diffrent value.