Change appointment day by day in timeline

2 posts, 0 answers
  1. NICOLAS
    NICOLAS avatar
    3 posts
    Member since:
    Aug 2013

    Posted 09 Aug 2013 Link to this post

    Hi,

    I want to change appointment day by day (with the cursor) in timeline (not minute by minute).

    This is my xaml code :

    <telerik:RadScheduleView  Grid.Row="1"
                                     AppointmentsSource="{Binding LstAppointments}"
                                     ResourceTypesSource="{Binding LstSchedulerHeaderOperations}"
                                     CategoriesSource="{Binding Categories}"
                                     CurrentDate="{Binding CurrentDate}"
                                     SelectedSlot="{Binding SelectedSlot, Mode=TwoWay}" Margin="10,20,10,10">
                    <telerik:RadScheduleView.ViewDefinitions>
                        <telerik:TimelineViewDefinition VisibleDays="65"  MajorTickLength="1day" MinorTickLength="1day"
                            TimerulerMajorTickStringFormat="{}{0:dd}">
                            <telerik:TimelineViewDefinition.GroupTickLength>
                                <local:MonthlyTickProvider />
                            </telerik:TimelineViewDefinition.GroupTickLength>
                        </telerik:TimelineViewDefinition>
                    </telerik:RadScheduleView.ViewDefinitions>
                    <scheduleView:RadScheduleView.GroupDescriptionsSource>
                        <scheduleView:GroupDescriptionCollection>
                            <scheduleView:ResourceGroupDescription ResourceType="OP" />
                            <telerik:ResourceGroupDescription ResourceType="DETAIL" />
                        </scheduleView:GroupDescriptionCollection>
                    </scheduleView:RadScheduleView.GroupDescriptionsSource>
                </telerik:RadScheduleView>


    My MonthlyTickProvider class :

    public class WeeklyTickProvider : DependencyObject, ITickProvider
        {
            public static readonly DependencyProperty CurrentDateProperty =
                DependencyProperty.Register(
                "CurrentDate", typeof(DateTime),
                typeof(WeeklyTickProvider), null
                );
     
            public DateTime CurrentDate
            {
                get { return (DateTime)GetValue(CurrentDateProperty); }
                set { SetValue(CurrentDateProperty, value); }
            }
     
            public static readonly DependencyProperty VisibleDaysProperty =
                DependencyProperty.Register(
                "VisibleDays", typeof(int),
                typeof(WeeklyTickProvider), null
                );
     
            public int VisibleDays
            {
                get { return (int)GetValue(VisibleDaysProperty); }
                set { SetValue(VisibleDaysProperty, value); }
            }
     
     
            public string GetFormatString(IFormatProvider formatInfo, string formatString, DateTime currentStart)
            {
                var start = currentStart.Date;
                var end = this.GetNextStart(TimeSpan.Zero /*not used, see below*/, currentStart).AddSeconds(-1);
     
                if (this.CurrentDate > start && this.CurrentDate < end)
                    start = this.CurrentDate;
     
                //var viewEnd = this.CurrentDate.AddDays(this.VisibleDays).AddSeconds(-1);
     
                //if (viewEnd < end)
                //    end = viewEnd;
     
                return string.Format(formatInfo, "{0:dd/MMMM/yyyy} - {1:dd/MMMM/yyyy}", start, end);
            }
     
            public DateTime GetNextStart(TimeSpan pixelLength, DateTime currentStart)
            {
                var currentDate = currentStart.Date;
     
                var weekStart = CalendarHelper.GetFirstDayOfWeek(currentStart, DayOfWeek.Tuesday);
                if (weekStart == currentDate)
                {
                    return weekStart.AddDays(7);
                }
                return weekStart;
            }
        }
     
        public class MonthlyTickProvider : ITickProvider
        {
            public string GetFormatString(IFormatProvider formatInfo, string formatString, DateTime currentStart)
            {
                return string.Format(formatInfo, "{0:MMMM - yyyy}", currentStart);
            }
     
            public DateTime GetNextStart(TimeSpan pixelLength, DateTime currentStart)
            {
                var currentDate = currentStart.Date;
     
                var monthStart = CalendarHelper.GetStartOfMonth(currentStart.Year, currentStart.Month);
                if (monthStart == currentDate)
                {
                    return monthStart.AddMonths(1);
                }
                return monthStart;
            }
        }



  2. NICOLAS
    NICOLAS avatar
    3 posts
    Member since:
    Aug 2013

    Posted 09 Aug 2013 Link to this post

    Ok it was just Snap Appointements to active.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top