private void datagrid_ItemsSourceChanged(object sender, GridItemsSourceChangedEventArgs e)
{
if (datagrid.View != null)
reflector = datagrid.View.GetPropertyAccessProvider();
else
reflector = null;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var totalRowIndex = datagrid.View.Records.Count;
var totalColumnIndex = datagrid.Columns.Count;
for (int recordIndex = 0; recordIndex < totalRowIndex; recordIndex++)
{
for (int columnindex = 0; colindex < totalColumnIndex; columnindex++)
{
var record = this.datagrid.View.Records[recordIndex];
var mappingName = datagrid.Columns[columnindex].MappingName;
var currentCellValue = reflector.GetValue(record.Data, mappingName);
if (currentCellValue.ToString()== "Bulk")
{
object item = datagrid.View.Records[recordIndex];
datagrid.SelectedItems.Add(item);
}
}
}
}
|