I would like to change the position of the header arrow when sorting the column in a RadGridView. By default it appears above the column text, but I want it to be positioned to the RIGHT of that text.
I use VS2019 with the theme "Office2013Light".
Regards,
4 Answers, 1 is accepted
Hello, Eusebio,
If you want to position the arrow button when sorting to the right of the text you can change its Alignment property in the ViewCellFormatting event. Please refer to the following code snippet:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
var headerCell= e.CellElement as GridHeaderCellElement;
if (headerCell != null)
{
headerCell.Arrow.Alignment = ContentAlignment.MiddleRight;
}
else
{
headerCell.Arrow.ResetValue(LightVisualElement.AlignmentProperty, ValueResetFlags.Local);
}
}
I hope this helps. Should you have other question do not hesitate to contact me.
Regards,
Nadya
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).
It work if "headerCell" isn't null, else error.
Regards.
Hello, Eusebio,
You can use the following code snippet instead:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement is GridHeaderCellElement)
{
var headerCell = e.CellElement as GridHeaderCellElement;
headerCell.Arrow.Alignment = ContentAlignment.MiddleRight;
}
}
Let me know if you need further assistance.
Regards,
Nadya
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).
Hi Nadya,
Yes, it work.
Thank you very much.