This is a migrated thread and some comments may be shown as answers.
DayViewDefinition
20 Answers 266 Views
This is a migrated thread and some comments may be shown as answers.
Pooja
Top achievements
Rank 1
Pooja asked on 21 Sep 2011, 12:35 PM
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" />

20 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 21 Sep 2011, 01:58 PM
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 >>

0
Pooja
Top achievements
Rank 1
answered on 22 Sep 2011, 05:17 AM
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: 

0
Rosi
Telerik team
answered on 22 Sep 2011, 07:51 AM
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 >>

0
Pooja
Top achievements
Rank 1
answered on 26 Sep 2011, 10:46 AM
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.
0
Yana
Telerik team
answered on 28 Sep 2011, 09:36 AM
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 >>

0
test
Top achievements
Rank 1
answered on 29 Sep 2011, 10:08 PM

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>
0
Pooja
Top achievements
Rank 1
answered on 30 Sep 2011, 05:08 AM
It is the same behavior for me FirstVisibleTime is not working in Q2 2011 SP1.
0
Yana
Telerik team
answered on 30 Sep 2011, 09:40 AM
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 >>

0
test
Top achievements
Rank 1
answered on 30 Sep 2011, 03:01 PM
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
0
Yana
Telerik team
answered on 03 Oct 2011, 08:41 AM
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 >>

0
test
Top achievements
Rank 1
answered on 03 Oct 2011, 03:49 PM
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
0
Pooja
Top achievements
Rank 1
answered on 04 Oct 2011, 06:05 AM
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.
0
Yana
Telerik team
answered on 05 Oct 2011, 02:06 PM

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

0
test
Top achievements
Rank 1
answered on 05 Oct 2011, 07:35 PM
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
0
Yana
Telerik team
answered on 06 Oct 2011, 01:32 PM
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 >>

0
Pooja
Top achievements
Rank 1
answered on 12 Oct 2011, 10:37 AM
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.


0
Accepted
Yana
Telerik team
answered on 18 Oct 2011, 02:32 PM
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 >>

0
Pooja
Top achievements
Rank 1
answered on 21 Oct 2011, 10:13 AM
This seems to be working fine Yana. Thanks!
0
Cristiano
Top achievements
Rank 1
answered on 20 Aug 2012, 05:31 PM
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...
0
Yana
Telerik team
answered on 21 Aug 2012, 07:37 AM
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.

Asked by
Pooja
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Pooja
Top achievements
Rank 1
Yana
Telerik team
test
Top achievements
Rank 1
Cristiano
Top achievements
Rank 1
Share this question
or