C# 从DataRowView获取DataRow的一种方法
我目前正在尝试获取DataGrid中选定行的内容 问题是我实际上得到了一个DataRowView,但我不能用它做任何事情 我想访问DataGrid中所选行的所有字段 以下是帮助您的代码: XAML:C# 从DataRowView获取DataRow的一种方法,c#,wpf,xaml,datagrid,datarowview,C#,Wpf,Xaml,Datagrid,Datarowview,我目前正在尝试获取DataGrid中选定行的内容 问题是我实际上得到了一个DataRowView,但我不能用它做任何事情 我想访问DataGrid中所选行的所有字段 以下是帮助您的代码: XAML: <DataGrid SelectionUnit="FullRow" SelectedItem="{Binding SelectedZone, Mode=TwoWay}" AutoGenerateColumns="True" Margin="0,167,6,24" Name="existing
<DataGrid SelectionUnit="FullRow" SelectedItem="{Binding SelectedZone, Mode=TwoWay}" AutoGenerateColumns="True" Margin="0,167,6,24" Name="existingCase" Width="780" >
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<EventSetter Event="MouseDoubleClick" Handler="resultDataGrid_MouseDoubleClick"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
感谢您的帮助数据行视图有一个属性;-)
DataRowView
有一个属性;-)
DataRow row = ((DataRowView)SelectedZone).Row;
DataRow row = ((DataRowView)SelectedZone).Row;