SfDataGrid visual corruption on after scrolling

Hi,

Example of visual corruption: https://imgur.com/a/cKdL3sg
To reproduce modify Getting Started demo as follows

        public Form1()
        {
            InitializeComponent();
            var data = new OrderInfoCollection();
            sfDataGrid.DataSource = data.OrdersListDetails;
            sfDataGrid.Style.CellStyle.Font.Facename = "Consolas";
            sfDataGrid.Style.CellStyle.Font.Size = 12f;
            sfDataGrid.QueryRowStyle += Grid_QueryRowStyle;
        }

        private void Grid_QueryRowStyle(object sender, QueryRowStyleEventArgs e)
        {
            if (e.RowType == RowType.DefaultRow)
                sfDataGrid.TableControl.RowHeights[e.RowIndex] = 35;
        }

3 Replies

DY Deivaselvan Y Syncfusion Team September 28, 2018 12:34 PM UTC

Hi Tipal,  

Thanks for contacting Syncfusion support. 

This rendering issue may have occurred due to row height has been updated into the QueryRowStyle event instead of QueryRowHeight. To resolve this rendering issue, you should use SfDataGrid.QueryRowHeight event for changing the row height of the default rows. Please refer to the following code example and sample from the given location. 

Code Example: 

this.sfDataGrid.QueryRowHeight += sfDataGrid_QueryRowHeight; 
 
void sfDataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
{ 
    if (this.sfDataGrid.View.TopLevelGroup != null ) 
    { 
        if (IsDefauldRow(e.RowIndex)) 
        { 
            e.Handled = true; 
            e.Height = 50; 
        } 
    } 
    else if (!(this.sfDataGrid.TableControl.IsTableSummaryIndex(e.RowIndex) || 
        this.sfDataGrid.IsAddNewRowIndex(e.RowIndex) || 
        this.sfDataGrid.IsFilterRowIndex(e.RowIndex) ||  
        this.sfDataGrid.TableControl.GetHeaderIndex() == e.RowIndex)) 
    { 
        e.Handled = true; 
        e.Height = 50; 
    } 
} 
 
bool IsDefauldRow(int rowIndex) 
{ 
    var startIndex = this.sfDataGrid.TableControl.ResolveStartIndexBasedOnPosition(); 
    var record = this.sfDataGrid.View.TopLevelGroup.DisplayElements[rowIndex - startIndex]; 
 
    return record != null && record is RecordEntry; 
} 



Regards, 
Deivaselvan 



T T September 28, 2018 07:14 PM UTC

Thank you!


DY Deivaselvan Y Syncfusion Team September 28, 2018 07:42 PM UTC

Hi Tipal,

You are welcome and please get back to us if you need any other assistance.

Regards,
Deivaselvan 


Loader.
Up arrow icon