我有一个包含两列的数据网格;以及修井。 WPF:
<DataGrid x:Name="PrintReport1" ItemsSource="{Binding TableResults}" AutoGenerateColumns="False" FontFamily="Tahoma" FontSize="14"
IsReadOnly="True" CanUserSortColumns="True" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" SelectionMode="Extended" SelectionUnit="Cell">
<DataGrid.Columns>
<DataGridTextColumn Header="Well" Binding="{Binding WellName, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="dg_MouseLeftButtonDown_Injector" />
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Recommendated Workover Type" Binding="{Binding WorkoverRecommendation, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" > </DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
第一列有一个eventsetter
事件,当用户点击特定单元格时,我可以通过该事件获取列值:
private void dg_MouseLeftButtonDown_Injector(object sender, MouseButtonEventArgs e)
{
DataGridCell cell = sender as DataGridCell;
dynamic dataObject = cell.DataContext;
string InjectorName = dataObject.WellName;
//do something...
}
我的问题是如何获得相应的第二列值?
例如,如果datagrid
看起来像这样:
Well Workover
Well1 ABC
Well2 DEF
如果用户点击&#34; Well2&#34;单元格,如何获得相应的修复值; &#34; DEF&#34;
答案 0 :(得分:-1)
POST /v4_6_release/apis/3.0/service/tickets HTTP/1.1
Host: login.mycompany.com
Authorization: Basic changedforthispost==
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: changedforthispost
{
"summary":"A results summary has been uploaded",
"company": { "id": 2 }
}