ScheduleView Appointment by code?

3 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 21 Apr 2012 Link to this post

    Hi,

    i'm looking for a code-snipe which shows me how so create an appointment by c#. It is no problem to create a simple appointment for one day. But if i try to crearte an appointment in serie it doesn't work. The Problem could be the DateTime Property Start and End.

    It get this Error:
    ArgumentOutOfRangeException.

    The added or subtracted value results in an unrepresentable DateTime.
    Parameter name: value


    NOTE:
    Beginn with the Example "ScheduleView and TimeBar". This works fine so far. But if you create an Appointment with a frequency ex.:
    Pattern.Frequency = RecurrenceFrequency.Monthly; you will get the error above. 
    This part from xaml causes the error: CurrentDate="{Binding ElementName=TimeBar, Path=SelectionStart}"

    <telerik:RadScheduleView x:Name="MainSchedule" Grid.Row="1" Margin="2" TimeMarkersSource="{Binding TimeMarkers}"
    CategoriesSource="{Binding Categories}" telerik:StyleManager.Theme="Metro" MinAppointmentHeight="10"
    NavigationHeaderVisibility="Collapsed" AppointmentsSource="{Binding Appointments}"ResourceTypesSource="{Binding ResourceTypes}" CurrentDate="{Binding ElementName=TimeBar, Path=SelectionStart}">

    Error:
    System.Reflection.TargetInvocationException
    Ein Aufrufziel hat einen Ausnahmefehler verursacht.
       bei System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       bei System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       bei System.Delegate.DynamicInvokeImpl(Object[] args)
       bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

     
    System.ArgumentOutOfRangeException
    Der addierte oder subtrahierte Wert ergibt eine nicht darstellbare DateTime.
    Parametername: value
       bei System.DateTime.Subtract(TimeSpan value)
       bei Telerik.Windows.Controls.ScheduleView.AppointmentExtensions.GetOccurrences(IAppointment appointment, DateTime from, DateTime to) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Extensions\AppointmentExtensions.cs:Zeile 26.
       bei Telerik.Windows.Controls.AppointmentsHelper.GetRecurrenceOccurrences(IAppointment appointment, IDateSpan effectiveRange, IEnumerable`1 parentKeys, IEnumerable`1 groupedResources) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Helpers\AppointmentsHelper.cs:Zeile 47.
       bei Telerik.Windows.Controls.ScheduleViewBase.GetOccurrences(IAppointment appointment, IDateSpan effectiveSpan, IEnumerable`1 parentKeys) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 4007.
       bei Telerik.Windows.Controls.ScheduleViewBase.<>c__DisplayClass85.<GetAppointmentSlotGroupInfos>b__7f(IAppointment a) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 1624.
       bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
       bei System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
       bei System.Linq.Enumerable.<SelectManyIterator>d__1d`2.MoveNext()
       bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       bei Telerik.Windows.Controls.ScheduleViewBase.GetAppointmentSlotGroupInfos(GroupItemInfo groupItemInfo, Boolean isAllDayArea) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 1623.
       bei Telerik.Windows.Controls.ScheduleViewBase.InitializeColumnsAndUpdateMaxIntersectedAppointmentsCount() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 4028.
       bei Telerik.Windows.Controls.ScheduleViewBase.Initialize() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 3953.
       bei Telerik.Windows.Controls.ScheduleView.ScheduleViewDataConnection.OnNotifyingDataSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleViewDataConnection.cs:Zeile 776.
       bei Telerik.Windows.Controls.ScheduleView.ScheduleViewDataConnection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleViewDataConnection.cs:Zeile 595.
       bei System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
       bei System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
       bei System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       bei System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       bei System.Windows.Data.ListCollectionView.RefreshOverride()
       bei System.Windows.Data.CollectionView.Refresh()
       bei System.Windows.Data.CollectionView.EndDefer()
       bei System.Windows.Data.CollectionView.DeferHelper.Dispose()
       bei Telerik.Windows.Controls.ScheduleView.ScheduleViewDataConnection.SetGroupingAndFiltering(IEnumerable`1 groupDescriptions) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleViewDataConnection.cs:Zeile 658.
       bei Telerik.Windows.Controls.ScheduleViewBase.RegenerateGroupHeaders() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 3802.
       bei Telerik.Windows.Controls.ScheduleViewBase.UpdatePropertiesDependantOnViewDefinition(String propertyName) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 3109.
       bei Telerik.Windows.Controls.ScheduleViewBase.OnCurrentDatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\ScheduleView.Common.cs:Zeile 2298.
       bei System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       bei System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       bei System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       bei System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       bei System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
       bei System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
       bei System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
       bei System.Windows.Data.BindingExpression.Activate(Object item)
       bei System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
       bei System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
       bei MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
       bei MS.Internal.Data.DataBindEngine.Run(Object arg)
       bei MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
       bei System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
       bei System.Windows.ContextLayoutManager.UpdateLayout()
       bei System.Windows.UIElement.UpdateLayout()
       bei System.Windows.Interop.HwndSource.SetLayoutSize()
       bei System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       bei System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       bei MS.Internal.DeferredHwndSource.ProcessQueue(Object sender, EventArgs e)

    Dear Telerik Team how can i solve this Problem ???????


    Thanks a log
    Best Regards
    R
  2. Dieter
    Dieter avatar
    4 posts
    Member since:
    Feb 2014

    Posted 28 May 2014 in reply to ITA Link to this post

    Hello Telerik, 

    i have currently the same error. How can i solve it? 

    Regards


  3. UI for WPF is Visual Studio 2017 Ready
  4. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 28 May 2014 Link to this post

    Hi Dieter,

    Could you please share some more details about your scenario? Do you face exactly the same issue as this thread is really old? I tested the explained scenario from the first post and everything worked as expected. So if you could share the version of the controls you are using and the exact steps to reproduce the issue that would be really helpful.

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top