0

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?

enter image description here

1 Answer 1

1

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);
    }
}

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.