RAGHAVENDRA
Top achievements
Rank 1
RAGHAVENDRA
asked on 29 Dec 2010, 05:19 PM
Private Sub RadDateTimePickerEndDate_Opened(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadDateTimePickerEndDate.Opened
Dim table As CalendarTableElement = TryCast(TryCast(Me.RadDateTimePickerEndDate.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.CalendarElement.CalendarVisualElement.Children(0).Children(1), CalendarTableElement)
For Each cell As CalendarCellElement In table.Children
If cell.Date < Me.DateTimePickerEndDateMin Then
cell.BackColor = Color.Red
Else
cell.BackColor = Color.Green
End If
If cell.[Date].DayOfWeek = DayOfWeek.Saturday Or cell.[Date].DayOfWeek = DayOfWeek.Sunday Then
cell.BackColor = Color.Transparent
End If
Next
End Sub
Hello All,
This is the code I am using to set the back ground color of the cells in the calendar control based on the min date.
1)I open the calendar the back color for all the dates less than the min date is showing up as red. Let us assume the min date is 6/12/2000
Now when I go to next month(i.e., 7/12/2000) the back color for all the cells in that month is supposed to be green. But this is not the case. Whats happening is that some of the Cells color is still Red and the others are green. But if i reopen the Calendar all the dates show up as Green. Now if I go back to 6/12/2000 all the dates including dates less than 12 th of June are showing up as Green too.
Is there any other event in which this code needs to be executed when i change the month using the arrow on the top of raddatepicker. I am using raddatetimepicker for winforms. Q3 2010 version. I do not see a viewchanged event here. Any help would be appreciated.
Thanks a lot.
Dim table As CalendarTableElement = TryCast(TryCast(Me.RadDateTimePickerEndDate.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.CalendarElement.CalendarVisualElement.Children(0).Children(1), CalendarTableElement)
For Each cell As CalendarCellElement In table.Children
If cell.Date < Me.DateTimePickerEndDateMin Then
cell.BackColor = Color.Red
Else
cell.BackColor = Color.Green
End If
If cell.[Date].DayOfWeek = DayOfWeek.Saturday Or cell.[Date].DayOfWeek = DayOfWeek.Sunday Then
cell.BackColor = Color.Transparent
End If
Next
End Sub
Hello All,
This is the code I am using to set the back ground color of the cells in the calendar control based on the min date.
1)I open the calendar the back color for all the dates less than the min date is showing up as red. Let us assume the min date is 6/12/2000
Now when I go to next month(i.e., 7/12/2000) the back color for all the cells in that month is supposed to be green. But this is not the case. Whats happening is that some of the Cells color is still Red and the others are green. But if i reopen the Calendar all the dates show up as Green. Now if I go back to 6/12/2000 all the dates including dates less than 12 th of June are showing up as Green too.
Is there any other event in which this code needs to be executed when i change the month using the arrow on the top of raddatepicker. I am using raddatetimepicker for winforms. Q3 2010 version. I do not see a viewchanged event here. Any help would be appreciated.
Thanks a lot.
8 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 29 Dec 2010, 05:47 PM
Hello,
You can get to the ViewChanged event in much the same way as you have reached the calendar, via the CurrentBehavior. Please can you try the sample below which seems to work for me in some simple tests.
Hope that helps
Richard
You can get to the ViewChanged event in much the same way as you have reached the calendar, via the CurrentBehavior. Please can you try the sample below which seems to work for me in some simple tests.
Imports Telerik.WinControls.UI Public Class Form1 Private m_DateTimePickerEndDateMin As DateTime = New Date(2010, 12, 28) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler CType(RadDateTimePickerEndDate.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.ViewChanged, AddressOf RadDateTimePickerEndDate_ValueChanged End Sub Private Sub RadDateTimePickerEndDate_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) ChangeCalendarColours() End Sub Private Sub RadDateTimePickerEndDate_Opened(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadDateTimePickerEndDate.Opened ChangeCalendarColours() End Sub Private Sub ChangeCalendarColours() Dim table As CalendarTableElement = TryCast(TryCast(Me.RadDateTimePickerEndDate.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.CalendarElement.CalendarVisualElement.Children(0).Children(1), CalendarTableElement) For Each cell As CalendarCellElement In table.Children ' check we are colouring date values and not M,T,W etc.. Dim result As Integer If Integer.TryParse(CStr(cell.Text), result) Then If Date.Compare(cell.Date, m_DateTimePickerEndDateMin) < 0 Then cell.BackColor = Color.Red Else cell.BackColor = Color.Green End If End If If cell.[Date].DayOfWeek = DayOfWeek.Saturday Or cell.[Date].DayOfWeek = DayOfWeek.Sunday Then cell.BackColor = Color.Transparent End If Next End Sub End ClassHope that helps
Richard
0
RAGHAVENDRA
Top achievements
Rank 1
answered on 29 Dec 2010, 06:04 PM
Hello Richard,
Thanks a lot for your help. It solved my issue.
Thanks Prata.
Thanks a lot for your help. It solved my issue.
Thanks Prata.
0
RAGHAVENDRA
Top achievements
Rank 1
answered on 29 Dec 2010, 06:27 PM
Richard,
Also, Where can I set the no of months to be passed through when I press the double arrow on the RadDateTimePicker.
I think we need to drill down deep into the properties but could not find it. It would be great if you can help me with this too.
Thanks
Prata.
Also, Where can I set the no of months to be passed through when I press the double arrow on the RadDateTimePicker.
I think we need to drill down deep into the properties but could not find it. It would be great if you can help me with this too.
Thanks
Prata.
0
Richard Slade
Top achievements
Rank 2
answered on 29 Dec 2010, 08:07 PM
Hi,
You can change the Fast Navigation Step on the calendar in this way.
Hope that helps, but let me know if you have any further questions
Thanks
Richard
You can change the Fast Navigation Step on the calendar in this way.
CType(RadDateTimePickerEndDate.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.FastNavigationStep = 12Hope that helps, but let me know if you have any further questions
Thanks
Richard
0
PROGRA
Top achievements
Rank 1
answered on 24 Jun 2013, 05:05 PM
Disculpen Tengo Un PROBLEMA CON EL RADDATETIMEPICKER QUIERO CREAR UNA CLASE SOBRE EL COMPONENTE PARA TENER EL COMPONENTE CON MIS FORMATO Y FUNCIONALIDAD DEFINIDA PERO AL SOLO HEREDAR LA CLASE Telerik.WinControls.UI.RadDateTimePicker CUANDO SE PONE EL COMPONENETE ES HABILITADO
LE APARECE UN
Contorno MAS OSCURO COMO PUEDO QUITARLO????
LE APARECE UN
Contorno MAS OSCURO COMO PUEDO QUITARLO????
0
Hi,
I would kindly ask you to post your question in English in order to allow us to address your question for you. Please note that English is the official language for correspondence with the support teams in Telerik, hence we will ask you to post all future questions in English.
Thank you for the understanding.
Regards,
Stefan
Telerik
I would kindly ask you to post your question in English in order to allow us to address your question for you. Please note that English is the official language for correspondence with the support teams in Telerik, hence we will ask you to post all future questions in English.
Thank you for the understanding.
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC 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 >>
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
PROGRA
Top achievements
Rank 1
answered on 26 Jun 2013, 08:15 PM
Sorry I have A PROBLEM WITH RADDATETIMEPICKER WANT TO CREATE A CLASS ON THE COMPONENT COMPONENT TO BE WITH MY FORM AND FUNCTION DEFINED BUT ONLY TO INHERIT THE CLASS WHEN PUTTING Telerik.WinControls.UI.RadDateTimePicker Componenet IS Enabled
COMES A
DARKER Contour CAN I REMOVE????
COMES A
DARKER Contour CAN I REMOVE????
0
Hi,
Although I am still not sure what you are trying to ask, I would guess that you are inheriting from RadDateTimePicker and the control does not look as expected. If this is the case, please take a look at the following article regarding this matter: http://www.telerik.com/support/kb/winforms/general/inherit-themes-from-radcontrols.aspx.
If this is not the case, please try to rephrase your question so I can understand your requirement and help you achieve it.
Regards,
Stefan
Telerik
Although I am still not sure what you are trying to ask, I would guess that you are inheriting from RadDateTimePicker and the control does not look as expected. If this is the case, please take a look at the following article regarding this matter: http://www.telerik.com/support/kb/winforms/general/inherit-themes-from-radcontrols.aspx.
If this is not the case, please try to rephrase your question so I can understand your requirement and help you achieve it.
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC 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 >>
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 >>
