The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a GridControl where I''ve set the SelectionMode to ''None'' and the ListboxSelectionMode to ''One''.
How might I go about drawing a bolder border around the selected row instead of changing the background color of the selected row? That is, I would like the selected row to look the same as an unselected row in every way except that the selected row would have a thicker border around it to make it stand out.
ADAdministrator Syncfusion Team May 18, 2006 03:54 AM UTC
Hi Don,
Colud you try this code to change the border of the selected rows in a grid using PrepareViewStyleInfo event. Here is a code snippet in C#.Net.
//Form''s Load Event
this.gridControl1.ListBoxSelectionMode = SelectionMode.One;
this.gridControl1.AlphaBlendSelectionColor = Color.PaleVioletRed;
GridRangeInfoList Rows = null;
private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
Rows = this.gridControl1.Model.Selections.GetSelectedRows(true,false);
if(e.ColIndex > 0 && Rows != null && Rows.AnyRangeIntersects(GridRangeInfo.Row(e.RowIndex )))
{
e.Style.Borders.Top = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick);
e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick);
if(e.ColIndex == 1)
{
e.Style.Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick);
}
else if(e.ColIndex == this.gridControl1.RowCount)
{
e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick);
}
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GridSelectionBorder_e94f6412.zip
Please let me know if this helps.
Best Regards,
Haneef
MSMaxim Software SystemsMay 18, 2006 02:04 PM UTC
The code you provided works (with one correction on the second last line - RowCount should be ColCount). Thanks!