<Style TargetType="syncfusion:GridCell" x:Key="style1">
<Setter Property="TextBlock.Foreground" Value="#FF2A6DCD"/>
</Style> |
if (e.Column.MappingName == "EmployeeArea")
{
e.Column.AllowFocus = true;
(e.Column as GridTextColumn).TextDecorations = TextDecorations.Underline;
e.Column.CellStyle = Application.Current.FindResource("style1") as Style;
} |
var visualcontainer = this.AssociatedObject.GetVisualContainer();
// get the row and column index based on the pointer position
var rowColumnIndex = visualcontainer.PointToCellRowColumnIndex(e.GetPosition(visualcontainer));
if (rowColumnIndex.IsEmpty)
return;
var columnName = AssociatedObject.Columns[rowColumnIndex.ColumnIndex].MappingName;
if (columnName==null|| columnName != "EmployeeArea")
return;
var colindex = this.AssociatedObject.ResolveToGridVisibleColumnIndex(rowColumnIndex.ColumnIndex);
if (colindex < 0 || colindex >= this.AssociatedObject.Columns.Count)
return;
var recordindex = this.AssociatedObject.ResolveToRecordIndex(rowColumnIndex.RowIndex);
if (recordindex < 0)
return;
var recordentry = this.AssociatedObject.View.GroupDescriptions.Count == 0 ? this.AssociatedObject.View.Records[recordindex] : this.AssociatedObject.View.TopLevelGroup.DisplayElements[recordindex];
//Returns if caption summary or group summary row encountered.
if (!recordentry.IsRecords)
return;
var record = (recordentry as RecordEntry).Data;
var value = record.GetType().GetProperty(AssociatedObject.Columns[colindex].MappingName).GetValue(record) ?? string.Empty;
MessageBox.Show("Cell Value : " + value); |