datagrid 选中行事件 SelectionChanged="dataGrid2_SelectionChanged"

 private void dataGrid2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
             DataRowView mys = (DataRowView)dataGrid2.SelectedItem;
             string BiminfoGuid = mys.Row[3].ToString();
             string EffectType = mys.Row[11].ToString();
             //注:下标是根据数据源中的列从0开始排的,跟界面绑定的列顺序无关。
             Location lt = new Location();
             lt.PositionAlarmInformation(BiminfoGuid, EffectType);           
        }

你可能感兴趣的:(WPF,DataGrid)