//Event Triggering
gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event Customization
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity != null && e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.MappingName == "Button")
{
string key = e.TableCellIdentity.RowIndex.ToString() + e.TableCellIdentity.ColIndex.ToString();
if (description.Count > 0 && description.ContainsKey(key))
{
string value = description[key];
if (description.Count > 0 && !String.IsNullOrEmpty(value))
{
e.Style.Description = value;
}
}
}
}
//Event Triggering
gridGroupingControl1.TableControlPushButtonClick += GridGroupingControl1_TableControlPushButtonClick;
//Event Customization
private void GridGroupingControl1_TableControlPushButtonClick(object sender, GridTableControlCellPushButtonClickEventArgs e)
{
rowIndex = e.Inner.RowIndex;
colIndex = e.Inner.ColIndex;
string key = rowIndex.ToString() + colIndex.ToString();
if (!description.ContainsKey(key))
{
description.Add(key, "Start");
}
else
{
string value = description[key];
if (value == "Start")
description[key] = "Stop";
else
description[key] = "Start";
}
} |
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null)
return;
if (e.TableCellIdentity.Column.Name == "Button" && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
var record = e.TableCellIdentity.DisplayElement.GetRecord();
string text = record.GetValue("Button").ToString();
e.Style.Description = text;
}
} |
this.gridGroupingControl1.TableControlPushButtonClick += GridGroupingControl1_TableControlPushButtonClick;
private void GridGroupingControl1_TableControlPushButtonClick(object sender, GridTableControlCellPushButtonClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
var record = style.TableCellIdentity.DisplayElement.GetRecord();
if (record != null)
{
string text = style.CellValue.ToString();
if (text.Equals("Start"))
record.SetValue("Button", "Stop");
else if (text.Equals("Stop"))
record.SetValue("Button", "Start");
else if (text.Equals("On"))
record.SetValue("Button", "Off");
else if (text.Equals("Off"))
record.SetValue("Button", "On");
else if (text.Equals("Click"))
record.SetValue("Button", "Clicked");
else if (text.Equals("Clicked"))
record.SetValue("Button", "Click");
else if (text.Equals("Press"))
record.SetValue("Button", "Pressed");
else if (text.Equals("Pressed"))
record.SetValue("Button", "Press");
}
} |