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

Change color of the grid - RadGridView

5 Answers 380 Views
GridView
This is a migrated thread and some comments may be shown as answers.
samuel
Top achievements
Rank 1
samuel asked on 30 Jan 2014, 08:09 AM
Hello,

​I would like to change the color of the horizontal grid lines for selected row and in MouseMove event (remove orange color)

screenshot attached.

Thank you very much.

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 03 Feb 2014, 03:05 PM
Hello Samuel,

Thank you for contacting Telerik Support.

In order to change the cell and row border for IsSelected, IsCurrent and HotTracking states, it is necessary to customize the theme by modifying the specific grid CellElement's and GridDataRowElement's repository items for the specific element states via our Visual Style Builder.

You can read more details about using the VisualStyleBuilder here:
1.     Loading predefined themes
2.     Working with Repository Items
3.     Saving and Loading Theme Files
4.     Loading Themes from an External File
5.     Loading Themes from a Resource
6.     Applying Theme to a Control
7.     http://tv.telerik.com/watch/winforms/visualstylebuilder/whats-new-visual-style-builder-q1-2010

You are allowed to set EnableHotTracking property to false in order to switch off the entire hot tracking indication.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kim
Top achievements
Rank 1
answered on 03 Feb 2014, 07:25 PM
I need to prevent the Grid from turning all gray when I disable it. how can i do that?
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Feb 2014, 04:13 PM
Hello Kim,

Thank you for contacting Telerik Support.

When you set the GridViewElement.Enabled property to false, you should set the UseDefaultDisabledPaint property to false as well, in order to prevent the grid from coloring in gray:
public Form1()
{
    InitializeComponent();
 
    this.radGridView1.GridViewElement.Enabled = false;
    this.radGridView1.GridViewElement.UseDefaultDisabledPaint = false;
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kim
Top achievements
Rank 1
answered on 05 Feb 2014, 04:51 PM
Thanks for your reply, When I use;

this.radGridView1.GridViewElement.Enabled = false

the user can still select a different row, and the row highlight disappears.

What I want to be able to do is prevent the grid form receiving any user input, but not change its visual appearance.


0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Feb 2014, 09:27 AM
Hello Kim,

Thank you for writing back.

In order to keep the normal visual representation of the RadGridView, but disabled its selection changing, sorting, grouping, editing functionalities, etc. it is necessary to stop them manually. One sample approach is introduced below:
public Form1()
{
    InitializeComponent();
 
    BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior;
    gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewGroupRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewFilteringRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewTableHeaderRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewHierarchyRowInfo));
    gridBehavior.UnregisterBehavior(typeof(GridViewDetailsRowInfo));
 
    this.radGridView1.ReadOnly = true;
    this.radGridView1.EnableHotTracking = false;
    this.radGridView1.AllowRowResize = false;
 
    this.radGridView1.CurrentRowChanging += radGridView1_CurrentRowChanging;
  
}
private void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e)
{
    e.Cancel = true;
}

Please do not hesitate to contact us if you have any additional questions.

Regards,
Desislava
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
GridView
Asked by
samuel
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Kim
Top achievements
Rank 1
Share this question
or