Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > Problems with BackColor

Not answered Problems with BackColor

Feed from this thread
  • Sean Overman avatar

    Posted on Apr 28, 2011 (permalink)

    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?

    Reply

  • Ivan Todorov Ivan Todorov admin's avatar

    Posted on Apr 29, 2011 (permalink)

    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

    Reply

  • Shawn Shaddock avatar

    Posted on Feb 9, 2012 (permalink)

    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.

    Reply

  • Ivan Todorov Ivan Todorov admin's avatar

    Posted on Feb 13, 2012 (permalink)

    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 >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > Problems with BackColor
Related resources for "Problems with BackColor"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]