Rounded Corners for SfDataGrid, Scrolling Pane & Scroll Bars
Is there in any way to achieve Rounded Corners for SfDataGrid, Scrolling Pane & Scroll Bars ?
Sample image attached for requirement
Attachment: Table_V04_20181114_154740.png_fde7d1cd.zip
Sample image attached for requirement
Attachment: Table_V04_20181114_154740.png_fde7d1cd.zip
SIGN IN To post a reply.
3 Replies
MA
Mohanram Anbukkarasu
Syncfusion Team
November 15, 2018 12:53 PM UTC
Hi Avinash,
Thanks for contacting Syncfusion support.
Currently we don’t have support to get rounded corners for SfDataGrid, scrolling pane and scrollbars as per the given image.
However we can provide a workaround to get the rounded corners only for the SfDataGrid by creating a custom SfDataGrid control. Please refer to the following code example and sample from the given location.
Code example :
|
public class CustomDataGrid : SfDataGrid
{
private int radius = 10;
[DefaultValue(10)]
public int Radius
{
get { return radius; }
set
{
radius = value;
this.RecreateRegion();
}
}
private GraphicsPath GetRoundRectagle(Rectangle bounds, int radius)
{
GraphicsPath path = new GraphicsPath();
path.AddArc(bounds.X, bounds.Y, radius, radius, 180, 90);
path.AddArc(bounds.X + bounds.Width - radius, bounds.Y, radius, radius, 270, 90);
path.AddArc(bounds.X + bounds.Width - radius, bounds.Y + bounds.Height - radius, radius, radius, 0, 90);
path.AddArc(bounds.X, bounds.Y + bounds.Height - radius, radius, radius, 90, 90);
path.CloseAllFigures();
return path;
}
private void RecreateRegion()
{
var bounds = new Rectangle(this.ClientRectangle.Location, this.ClientRectangle.Size);
bounds.Inflate(-1, -1);
using (var path = GetRoundRectagle(bounds, this.Radius))
this.Region = new Region(path);
this.Invalidate();
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
this.RecreateRegion();
}
} |
Regards,
Mohanram A.
NI
Niraj
March 17, 2025 02:08 PM UTC
Unable to download
MS
Malini Selvarasu
Syncfusion Team
March 18, 2025 02:57 PM UTC
Hi Niraj,
Sorry for the inconvenience. We have reattached the sample below, and it has been downloaded properly.
Regards,
Malini Selvarasu
Attachment: SfDataGrid_Demo_(2)_89de32dd.zip
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
AV Avinash
- Nov 14, 2018 10:21 AM UTC
- Mar 18, 2025 02:57 PM UTC