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

DayViewDefinition in behind code

4 Answers 130 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Patrick asked on 21 Nov 2011, 07:05 PM
Hi,

I would like to customize the DayViewDefinition in behind code (VB). When my app start, the information will be get from the database. Now the only way I found to do it...is in XAML...
<Horaire:DayViewDefinition DayStartTime="06:00"
                          DayEndTime="23:00"    
                           MajorTickLength
="1h"    
                           MinorTickLength
="5min"    
                           TimerulerMinorTickStringFormat
=":{0:mm} "                                                                
                           TimerulerMajorTickStringFormat
="{}{0:HH}:{0:mm} "    
                           MinTimeRulerExtent
="4000"/>

Thanks for you help.

4 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 24 Nov 2011, 12:26 PM
Hello Patrick,

In order to customize the DayViewDefinition in code you have to either give it a x:Name or create it there. For example:

Public Sub New()
        InitializeComponent()
        Dim dayView As DayViewDefinition
        dayView = New DayViewDefinition
        dayView.DayEndTime = New TimeSpan(6, 0, 0)
        dayView.DayStartTime = New TimeSpan(23, 0, 0)
        dayView.TimerulerMinorTickStringFormat = ":{0:mm}"
    End Sub

You could find a whole example in this online demo: http://demos.telerik.com/silverlight/#ScheduleView/ScheduleViewConfigurator

Hope this helps.

Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Patrick
Top achievements
Rank 2
answered on 24 Nov 2011, 08:53 PM
Hi Konstantina
My problem is with 2 differents properties that I can setup in XAML but they are not accessible by code....(See the image)

- MinorTickLength
- TimerulerMinorTickStringFormat

Thanks
0
Accepted
Konstantina
Telerik team
answered on 25 Nov 2011, 10:18 AM
Hi Patrick,

You need to cast the ViewDefinition to the correct one. For example:

Private Sub scheduleView_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) 
        Dim dayView As DayViewDefinition 
        dayView = TryCast(scheduleView.ViewDefinitions.Item(0), DayViewDefinition) 
        dayView.MajorTickLength = New FixedTickProvider(New DateTimeInterval(5, 0, 0, 0, 0)) 
    End Sub


Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Patrick
Top achievements
Rank 2
answered on 25 Nov 2011, 03:26 PM
Hi,

Thank you very much!!
Tags
ScheduleView
Asked by
Patrick
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Patrick
Top achievements
Rank 2
Share this question
or