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

Problems with BackColor

3 Answers 85 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Sean Overman
Top achievements
Rank 1
Sean Overman asked on 28 Apr 2011, 11:18 PM
I'm using the following method to change the background colors on my scheduler cells.

List<SchedulerDayViewElement> dayViews = ((SchedulerDayViewGroupedByResourceElement)radScheduler1.SchedulerElement.ViewElement).GetDayViewElements();
foreach (SchedulerDayViewElement dve in dayViews) {
    foreach (SchedulerCellElement sce in dve.DataAreaElement.Table.GetCells()) {
        sce.BackColor = Color.FromArgb(230, 230, 230);
    }
}

This is a simplified example, as I have more logic in my application to figure out what colors certain cells should be.

The problem is when I set that BackColor property the whole cell gets all whacked out.   From what I can tell, not only is it changing the backcolor, but also the "hoverbackcolor" and the "selectedbackcolor", both of which I have no idea how to set.  Or not set, for that matter.

Also, what is BackColor2, BackColor3, BackColor4?

3 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 29 Apr 2011, 12:08 PM
Hello Sean Overman,

Thank you for contacting us.

The hover and selected back colors are set through the theme (using Visual Style Builder). When you set a property explicitly, it has higher priority than the theme settings. That is why by setting the BackColor you loose the hovered and selected state settings.

As to your second question, the BackColor, BackColor2, BackColor3 and BackColor4 are used to set gradient colors (along with the GradientStyle, GradientAngle and GradientPercentage) properties.

If you can give me some more details about the reason why you want to change cells' back colors, I can try to provide a solution for this case.

I hope this helps. Feel free to write back if you have any additional questions.

Best wishes,
Ivan Todorov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shawn Shaddock
Top achievements
Rank 1
answered on 09 Feb 2012, 05:37 PM
I need to do something similar. I am making an appointment scheduler and our users like to see the top of the hour cells in a different color to make navigating and booking appointments easier. For example the cells that fall at 9 AM, 10 AM, 11 AM, etc... would be shaded blue.
0
Ivan Todorov
Telerik team
answered on 13 Feb 2012, 12:10 PM
Hi Shawn,

Thank you for your question.

You can use the CellFormatting event of RadScheduler to achieve this:
void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
{
    if (e.CellElement.Date.Hour >= 10 && e.CellElement.Date.Hour <=12)
    {
        e.CellElement.BackColor = Color.Aquamarine;
    }
}

I hope you find it useful.

Kind regards,
Ivan Todorov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Scheduler and Reminder
Asked by
Sean Overman
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Shawn Shaddock
Top achievements
Rank 1
Share this question
or