This is a migrated thread and some comments may be shown as answers.

Setting grid lines width

3 Answers 20 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zygmunt
Top achievements
Rank 1
Iron
Iron
Zygmunt asked on 20 Apr 2021, 08:28 AM

Hello

I would like to set grid lines width to bold them in gridview. Is it possible?

 

All the best

 

3 Answers, 1 is accepted

Sort by
0
Nadya
Telerik team
answered on 20 Apr 2021, 08:44 AM

Hello, Zygmunt,

In order to increase the border's width of the cells in the grid it is suitable to use the CellFormatting event and set the BorderBottomWidth property:

private void RadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridDataCellElement)
    {
        e.CellElement.BorderBottomWidth = 5;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BorderBottomWidthProperty, ValueResetFlags.Local);
    }
}

I hope this helps. Let me know if you have other questions.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Zygmunt
Top achievements
Rank 1
Iron
Iron
answered on 20 Apr 2021, 09:30 AM

Presented solution has for my at least two problems .
First is that border is not setting in GridViewRowHeaderColumn what is shown in problem1.png image.
Second issue is presended in problem2.png image. When the cell is in edit mode it grows and cover the cell border. 

0
Nadya
Telerik team
answered on 20 Apr 2021, 03:01 PM

Hello, Zygmunt,

Note, the look of our controls is defined through themes. When using the formatting events you are able to modify some properties of the visual cells, however, if you need to define a new custom look in your grid you should consider creating a custom theme that would fit your requirements.

If you want to set the same border width to the GridViewRowHeaderColumn you can use the following code snippet in the ViewCellFormatting event:

private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridRowHeaderCellElement || e.CellElement is GridDataCellElement)
    {
        e.CellElement.BorderBottomWidth = 10;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BorderBottomWidthProperty, ValueResetFlags.Local);
    }
}

According to your second question, if you need to modify the look of the cell/row when it is selected or in edit mode, you should modify the theme that you use in the Visual Style Builder tool. More information about working with VSB is available here: 
https://docs.telerik.com/devtools/winforms/knowledge-base/customize-a-theme 
https://docs.telerik.com/devtools/winforms/tools/visual-style-builder/working-with-visual-style-builder/working-with-repository-items 

I hope this information helps. Let me know if I can assist you further.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Zygmunt
Top achievements
Rank 1
Iron
Iron
Answers by
Nadya
Telerik team
Zygmunt
Top achievements
Rank 1
Iron
Iron
Share this question
or