We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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

1 Reply

MA Mohanram Anbukkarasu Syncfusion Team November 15, 2018 04:53 AM

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. 


Loader.
Live Chat Icon For mobile
Up arrow icon