DayViewDefinition

21 posts, 1 answers
  1. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 21 Sep 2011 Link to this post

    Please let me know, how we can configure DayViewDefinition so that user's default view is from 8:00 AM to 5:00 PM. But user can scroll to view non working hours as well.

     Currently I have used DayViewDefinition as mentioned below. But user cannot scroll day view to see non working hours.


    <telerik:DayViewDefinition   DayStartTime="08:00" DayEndTime="17:00"  MajorTickLength="1h" MinorTickLength="30min" MaxTimeRulerExtent="700" MinTimeRulerExtent="700" />
  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 21 Sep 2011 Link to this post

    Hi Pooja,

    I suggest you set the FirstVisibleTime property of the view definition instead of DayStartTime.

    Kind regards,
    Rosi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 22 Sep 2011 Link to this post

    I did not get FirstVisibleTime property in view definition. But there is one with RadscheduleView. But when i am setting FirstVisibleTime property of RadScheduleView it is giving me exception. I am using Q2 2011 controls.

    <telerik:RadScheduleView Style="{StaticResource RadScheduleViewStyle1}" x:Name="calendarView" ActiveViewDefinitionIndex="2"
                                     AllowDrop="False" AutomationProperties.AutomationId="OWS_Results_Calendar_SchedulerView" ShowDialog="calendarView_ShowDialog"
                                     AppointmentSelectionChanged="calendarView_AppointmentSelectionChanged" FirstVisibleTime="08:00" >
               <telerik:RadScheduleView.ViewDefinitions >
                   <telerik:DayViewDefinition   MajorTickLength="1h" MinorTickLength="30min" MaxTimeRulerExtent="700" MinTimeRulerExtent="700" />
                   <telerik:WeekViewDefinition   MajorTickLength="1h" MinorTickLength="30min"  MaxTimeRulerExtent="700" MinTimeRulerExtent="700"  />
                   <telerik:MonthViewDefinition VisibleDays="30" FirstDayOfWeek="Monday"    />
               </telerik:RadScheduleView.ViewDefinitions>
               <telerik:RadScheduleView.DragDropBehavior>
                   <local:CalendarDragDropBehavior></local:CalendarDragDropBehavior>
               </telerik:RadScheduleView.DragDropBehavior>
           </telerik:RadScheduleView>

    exception:
    System.Windows.Markup.XamlParseException occurred
      Message=Element is already the child of another element. [Line: 0 Position: 0]
      LineNumber=0
      LinePosition=0
      StackTrace:
           at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
           at Symantec.EV.Search.Client.WebApp.UserControls.CalendarView.InitializeComponent()
           at Symantec.EV.Search.Client.WebApp.UserControls.CalendarView..ctor()
      InnerException: System.NullReferenceException
           Message=Object reference not set to an instance of an object.
           StackTrace:
                at Telerik.Windows.Controls.ScheduleView.LogicalScrollingExtensions.Normalize(IGroupIdentifier group, IGroupingConfigurationSettings groupingConfiguration)
                at Telerik.Windows.Controls.ScheduleViewBase.UpdatePhysicalScroll()
                at Telerik.Windows.Controls.ScheduleViewBase.OnLogicalScrollPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
                at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
                at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
                at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
                at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
                at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
                at Telerik.Windows.Controls.ScheduleViewBase.set_FirstVisibleTime(TimeSpan value)
           InnerException: 

  5. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 22 Sep 2011 Link to this post

    Hello Pooja,

    There was a bug that is already fixed in our internal build and the SP release that you can find available for download in your account.

    Another way to solve the issue is to hook on the Loaded event of RadScheduleView and set the FirstVisibleTime property in its event handler.

    Regards,
    Rosi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 26 Sep 2011 Link to this post

    I installed Q2 2011 SP1 controls, set FirstVisibleTime property to new TimeSpan(7,0,0). It does not make any change in UI. Day View visible time starts at 12:00 AM only.
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 28 Sep 2011 Link to this post

    Hi Pooja,

    I've tested the FirstVisibleTime property and it works as expected at our side. Please note that the view is scrolled to the set time only when there is not enough space, I've attached a short video to demonstrate how it works.

    Best wishes,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. test
    test avatar
    17 posts
    Member since:
    May 2007

    Posted 29 Sep 2011 Link to this post

    FirstVisibleTime is not working for me as well. There was a run-time error. After I downloaded 01549RadControls_for_Silverlight4_2011_2_0927_TRIAL_hotfix today. No run-time error now. But the starting time is still 12: 00 am. Nothing changed.
    Thanks
    Wei

    public MainPage(int committeeID)
           {
               InitializeComponent();
               _vm = new MeetingsViewModel(committeeID);
               this.DataContext = _vm;
              radScheduleView1.FirstVisibleTime = new TimeSpan(7, 0, 0);
             
           }
    <telerik:RadBusyIndicator IsBusy="{Binding IsLoading}">
               <telerik:RadScheduleView HorizontalAlignment="Left"
                                    AppointmentsSource="{Binding Meetings}"  
                       
                                    Name="radScheduleView1" >
                                                <telerik:RadScheduleView.ViewDefinitions>
                        
                       <telerik:DayViewDefinition Title="List"  MaxTimeRulerExtent="700" MinTimeRulerExtent="700"  MajorTickLength="1h" MinorTickLength="30min"/>
                   </telerik:RadScheduleView.ViewDefinitions>
               </telerik:RadScheduleView>
           </telerik:RadBusyIndicator>
  9. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 30 Sep 2011 Link to this post

    It is the same behavior for me FirstVisibleTime is not working in Q2 2011 SP1.
  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 30 Sep 2011 Link to this post

    Hello,

    Can you try setting Height property of the ScheduleView to "400", for example, so that the vertical scrollbar will be shown - is the FirstVisibleTime property applied correctly now?

    If this doesn't help, please send us short video (you can use Jing) showing the erroneous behavior. You should open a support ticket and attach it there.

    Best wishes,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. test
    test avatar
    17 posts
    Member since:
    May 2007

    Posted 30 Sep 2011 Link to this post

    Still does not work. Can you please attach your source code in this little show? I want try it in my local machine.

    Thanks
    Wei
  12. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 03 Oct 2011 Link to this post

    Hi Wei,

    Please find my test project attached.

    Hope it helps.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  13. test
    test avatar
    17 posts
    Member since:
    May 2007

    Posted 03 Oct 2011 Link to this post

    Hi Yana:
    It did work running your sample. I found why my code did not work
    <Grid x:Name="LayoutRoot" Background="White">
           
           <telerik:RadBusyIndicator IsBusy="{Binding IsLoading}">
               <telerik:RadScheduleView HorizontalAlignment="Left"
                                    AppointmentsSource="{Binding Meetings}"  
                       
                                    Name="radScheduleView1" >
                                                <telerik:RadScheduleView.ViewDefinitions>
                        
                       <telerik:DayViewDefinition   MajorTickLength="1h" MinorTickLength="30min"/>
                   </telerik:RadScheduleView.ViewDefinitions>
               </telerik:RadScheduleView>
           </telerik:RadBusyIndicator>
       </Grid>
    Obviously it was caused by "RadBusyIndicator ". After I remove it, my code starts to work. But Why? Can your guys research it?

    Thanks
    Wei
  14. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 04 Oct 2011 Link to this post

    Hi,

    I do not want to set the height of RadScheduleView, it should get displayed in the area available to it. Even in this case say I set FirstVisibleTime to 7:00 AM then in day and week view, time ruler should scroll till 7:00 AM and should show 7:00 AM into view. User should then be able to scroll up and down to see other times. Please do let me know if this is achievable.
  15. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Oct 2011 Link to this post


    Wei: I guess that you're using some service to load the appointments and when FirstVisibleTime property is set, the appointments are not loaded yet. I suggest to set the property after the appointments are loaded in order to workaround it.

    Pooja:  I've set the height only to explain how the property works - generally it's not needed. As I explained in one of my previous posts, the view is scrolled to the set time only when there is not enough space and a scrollbar is already available.

    Greetings,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  16. test
    test avatar
    17 posts
    Member since:
    May 2007

    Posted 05 Oct 2011 Link to this post

    Yana:
    My silverlight testing project does not load any data. You know what, I tested your sample project by added RadBusyIndicator tag
    <telerik:RadBusyIndicator IsBusy="{Binding IsLoading}">
    <telerik:RadScheduleView x:Name="scheduleView1" AppointmentsSource="{Binding Appointments}" >
    <telerik:RadScheduleView.ViewDefinitions>
    <telerik:DayViewDefinition MajorTickLength="1h" MinorTickLength="30min" />
    <telerik:WeekViewDefinition />
    </telerik:RadScheduleView.ViewDefinitions>
    </telerik:RadScheduleView>
    </telerik:RadBusyIndicator>
    the above sample. Your project stopped working as well. You can just add IsLoading property, and set it is false. RadBusyIndicator is to set hourglass  It may be a bug, please research.

    Thanks
    Wei
  17. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 06 Oct 2011 Link to this post

    Hello Wei,

    You are right, I was able to observe the issue with the BusyIndicatior.  We'll research it, but for now could you please for now set the it in the Loaded event of the RadScheduleView?

    private void scheduleView_Loaded(object sender, RoutedEventArgs e)
    {
        this.scheduleView.FirstVisibleTime = new TimeSpan(7, 0, 0);
    }


    Best wishes,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  18. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 12 Oct 2011 Link to this post

    Hi Yana,
    For me FirstVisibleTime is not yet working.

    What I am trying to do is, when user comes to  Day View , view should scroll to the first appointment in the day. Similarly when user open Week view, view should scroll to first appointment in the week.

    For this I am using VisibleRangeChanged event of RadScheduleView. Since the FirstVisibleTime does not work for me I am now using ScrollTimeRuler() method. It works fine except in few cases like:

    1. when user switches between Month View and any other view 
    2. When user clicks on Group Header in month view, it open the week view but does not scroll correctly

    if (calendarView.ActiveViewDefinition.GetType() != typeof(MonthViewDefinition))
                {
                    //get the first appointment in the visible date range
                    CalendarItemVM firstAppointmentOfDay = ((List<CalendarItemVM>)calendarView.AppointmentsSource).Where(p => p.Start >= calendarView.VisibleRange.Start
                        && p.Start < calendarView.VisibleRange.End).OrderBy(o => o.Start).FirstOrDefault();
     
                    if (firstAppointmentOfDay != null)
                        calendarView.ScrollTimeRuler(firstAppointmentOfDay.Start.TimeOfDay, true, true);
                    else
                        calendarView.ScrollTimeRuler(new TimeSpan(8, 0, 0), true, true);
                }

    Any idea if this is a bug.


  19. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Oct 2011 Link to this post

    Hi Pooja,

    Could you please try it with a Dispatcher like this:

    if (calendarView.ActiveViewDefinition.GetType() != typeof(MonthViewDefinition))
    {
        Dispatcher.BeginInvoke(new Action(() =>
        {
     
            //get the first appointment in the visible date range
            CalendarItemVM firstAppointmentOfDay = ((List<CalendarItemVM>)calendarView.AppointmentsSource).Where(p => p.Start >= calendarView.VisibleRange.Start
                && p.Start < calendarView.VisibleRange.End).OrderBy(o => o.Start).FirstOrDefault();
     
            if (firstAppointmentOfDay != null)
                calendarView.ScrollTimeRuler(firstAppointmentOfDay.Start.TimeOfDay, true, true);
            else
                calendarView.ScrollTimeRuler(new TimeSpan(8, 0, 0), true, true);
        }));
    }

    It works as expected at our side.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  20. Pooja
    Pooja avatar
    55 posts
    Member since:
    Feb 2011

    Posted 21 Oct 2011 Link to this post

    This seems to be working fine Yana. Thanks!
  21. Cristiano
    Cristiano avatar
    13 posts
    Member since:
    Feb 2012

    Posted 20 Aug 2012 Link to this post

    Hi!

    I haven't yet figured it out.

    I tried the same (dispatcher), and it got a little better, since before this workaround it would go to 1am, not it's going to 4am, but the line of code clearly says 8am...

    private void SchedulerVisibleRangeChanged(object sender, EventArgs e)
    {
        //scroll to position
     
        if (scheduler.ActiveViewDefinition.GetType() != typeof(MonthViewDefinition))
        {
             Dispatcher.BeginInvoke(new Action(() =>
             {
                  scheduler.ScrollTimeRuler(new TimeSpan(8, 0, 0), true, true);
             }));
        }
    }

    I am using WPF by the way, but this post was the one more close to my issue at the moment.

    Thanks in advance...
  22. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 21 Aug 2012 Link to this post

    Hi Cristiano,

    Actually this is an issue in RadScheduleView, we've already logged it, you can vote for it and track its progress here.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner