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

Ruler Background Color

4 Answers 108 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 15 Mar 2013, 01:43 AM
When I set the ruler background color using the UI Editor, it shows properly in design time but in run time the color is set back the default. I have attached an image showing where I set the color.

4 Answers, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 16 Mar 2013, 10:34 PM
Something is overwriting settings at run time on several of these controls. I was able to solve this, and several other style problems in a similar manner. It would be nice if the settings in design time would carry over into run time.

This is the code I used to fix the color problem.
Dim SchedElement As SchedulerDayViewElement = RadScheduler1.SchedulerElement.ViewElement
SchedElement.DataAreaElement.Ruler.BackColor = Color.FromArgb(0, 151, 0)
0
Jeff
Top achievements
Rank 1
answered on 18 Mar 2013, 01:40 PM
I still need some help. I found the solution for the DayView but I need the code for WeekView and MonthView. 

My problem would be solved if the changes I made in design time using the UI Editor weren't overwritten. Even using the ControlSpy, when I switch from view to view the settings are overwritten after I change them.
0
Jeff
Top achievements
Rank 1
answered on 18 Mar 2013, 03:36 PM
Well, another hour later and I've found a solution. I'm not sure why the UI Editor settings don't work for these elements, but this code does. 
Only run the code for the specific view, otherwise you get an error. I run the code each time the view is changed.

I have custom navigation buttons and this is the Sub I run after they are clicked. I set "ActiveNavButton" to the name of the button and perform the steps needed to make it look right. At the end I set focus to the parent panel. This removes the thick border around the button that was clicked.

Hope this helps anyone who's been dealing with a similar issue.

Private Sub SetActiveNav()
    ButtonDay.BackColor = Color.FromArgb(0, 159, 60)
    ButtonWeek.BackColor = Color.FromArgb(0, 159, 60)
    ButtonMonth.BackColor = Color.FromArgb(0, 159, 60)
    ButtonTimeline.BackColor = Color.FromArgb(0, 159, 60)
    Select Case ActiveNavButton
        Case "ButtonDay"
            ButtonDay.BackColor = Color.FromArgb(0, 105, 39)
            Dim SchedElement As SchedulerDayViewElement = RadScheduler1.SchedulerElement.ViewElement
            SchedElement.DataAreaElement.Ruler.BackColor = Color.FromArgb(0, 159, 60)
        Case "ButtonWeek"
            ButtonWeek.BackColor = Color.FromArgb(0, 105, 39)
            Dim SchedElement As SchedulerDayViewElement = RadScheduler1.GetWeekView.Scheduler.SchedulerElement.ViewElement
            SchedElement.DataAreaElement.Ruler.BackColor = Color.FromArgb(0, 159, 60)
        Case ("ButtonMonth")
            Dim SchedElement As SchedulerMonthViewElement = RadScheduler1.GetMonthView.Scheduler.SchedulerElement.ViewElement
            For Each Child As RadElement In SchedElement.VerticalHeader.Children
                Dim Cell As SchedulerHeaderCellElement = TryCast(Child, SchedulerHeaderCellElement)
                If Cell IsNot Nothing Then
                    Cell.BackColor = Color.FromArgb(0, 159, 60)
                End If
            Next
            ButtonMonth.BackColor = Color.FromArgb(0, 105, 39)
        Case "ButtonTimeline"
            ButtonTimeline.BackColor = Color.FromArgb(0, 105, 39)
    End Select
 
    RadPanel2.Focus()
End Sub

0
Stefan
Telerik team
answered on 19 Mar 2013, 01:03 PM
Hi Jeff,

Thank you for writing.

As you noticed, when you change the view, the elements in RadScheduler are being recreated and you are loosing your design time settings. Another useful place to use your code would be the ActiveViewChanged event of the control, which is fired when the users changes the view.

Thank you for sharing you solution.

Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
Scheduler and Reminder
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or