I have a summary row on top of my grid which count ID column. I need to add a Button in this summary row on V column. Is this possible? How?
You can handle ViewCellFormatting event handler like this. I am not certain when should be the best time to add a new button element inside the summary cell, but the check for children's number ensures that the element will be added only once at the beginning. Alternatively you can just place an image in the current summary cell element, but the pushing effect will not be available.
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement.ColumnInfo.Name == "V" && e.CellElement is GridSummaryCellElement)
{
// adding a new button element
if (e.CellElement.Children.Count == 0)
{
var element = new RadButtonElement();
element.Margin = new Padding(12, 0, 12, 0);
element.ImageAlignment = ContentAlignment.MiddleCenter;
element.Alignment = ContentAlignment.MiddleCenter;
e.CellElement.Children.Add(element);
}
// or setting an image to the current element
//e.CellElement.Image = Properties.Resources.FilterImage;
}
else
{
e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.TextAlignmentProperty, ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
}
}