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

GridViewRatingColumn

3 Answers 118 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shanti 😎
Top achievements
Rank 2
Veteran
Shanti 😎 asked on 30 Jul 2019, 09:34 AM
How to customize appearance of the GridViewRatingColumn in radgidview 

3 Answers, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 31 Jul 2019, 03:21 PM
Hello, Shanti,

To customize appearance in GridViewRatingColumn in RadGridView you should subscribe to the CellFormatting event which fires when the content of a data cell needs to be formatted for display. If you would like to customize the element within the cell you should access the RadRatingElement. Please refer to the following example:
public partial class Form1 : RadForm
    {
        public Form1()
        {
            InitializeComponent();
             
            GridViewRatingColumn column = new GridViewRatingColumn("Rating Column");
            radGridView1.Columns.Add(column);
            radGridView1.Rows.Add(20);
            radGridView1.Rows.Add(35);
            radGridView1.Rows.Add(70);
            radGridView1.Rows.Add(30);
            radGridView1.Rows.Add(18);
 
            radGridView1.CellFormatting += RadGridView1_CellFormatting;
        }
 
        private void RadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
        {
            GridRatingCellElement cell = e.CellElement as GridRatingCellElement;
 
            if (cell!=null )
            {
                RatingStarVisualElement firstStar = cell.RatingElement.Items[0] as RatingStarVisualElement;
                firstStar.ValueElement.Fill.BackColor = Color.Red;
                firstStar.ValueElement.Fill.GradientStyle = GradientStyles.Solid;
                firstStar.HoverElement.Fill.BackColor = Color.Yellow;
                firstStar.HoverElement.Fill.GradientStyle = GradientStyles.Solid;
            }

            e.CellElement.BackColor = Color.Pink;
            e.CellElement.GridViewElement.GradientStyle = GradientStyles.Solid;
        }
    }

Additional information is available here: https://docs.telerik.com/devtools/winforms/controls/track-and-status-controls/rating/customization

I hope this helps. Should you have any other questions, I will be glad to help.

Regards,
Nadya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Shanti 😎
Top achievements
Rank 2
Veteran
answered on 01 Aug 2019, 10:39 AM

hellooo Nadya....
Thank you so much.
This code is working fine.

I searched a lot for finding a solution for this . finally i got .

 Thank you Again.

 

 


0
Nadya | Tech Support Engineer
Telerik team
answered on 01 Aug 2019, 12:40 PM
Hello, Shanti,

I am glad that this works for you. Do not hesitate to contact us if you have other questions.

Regards,
Nadya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Shanti 😎
Top achievements
Rank 2
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Shanti 😎
Top achievements
Rank 2
Veteran
Share this question
or