DisplayEndDate -Exception

2 posts, 0 answers
  1. Anjan Guha
    Anjan Guha avatar
    6 posts
    Member since:
    Jul 2009

    Posted 01 Feb 2010 Link to this post

    Hi,

    I am using the DatePicker as an usercontrol and in the Constructor of the Cntrol I am setting the following dates.

    dateCtrl.DisplayDateStart = Convert.ToDateTime("01/01/2003", System.Globalization.CultureInfo.CurrentCulture);                        dateCtrl.DisplayDateEnd = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture); 
    dateCtrl.SelectableDateEnd = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture);                        
    dateCtrl.SelectedDate = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture);

    and while loading the control it throws the following exception:

    System.ArgumentOutOfRangeException was unhandled
      Message="Invalid DisplayDateEnd value.\r\nParameter name: sender"
      Source="Telerik.Windows.Controls.Input"
      ParamName="sender"
      StackTrace:
           at Telerik.Windows.Controls.RadCalendar.OnDisplayDateEndChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
           at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
           at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
           at System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
           at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
           at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
           at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
           at System.Windows.FrameworkElement.ApplyTemplate()
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
           at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.Border.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.Control.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
           at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.Border.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.Control.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.ContextLayoutManager.UpdateLayout()
           at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
           at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
           at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
           at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
           at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
           at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
           at System.Threading.ExecutionContext.runTryCode(Object userData)
           at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
           at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
           at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
           at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.Run()
           at System.Windows.Application.RunDispatcher(Object ignore)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run(Window window)
           at System.Windows.Application.Run()
           at ITV.MSS.Shell.App.Main() in E:\MediaSales\MediaSalesSuite\Dev\Shell\ITV.MSS.Shell.Shell\obj\Debug\App.g.cs:line 0
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
           at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
           at System.Activator.CreateInstance(ActivationContext activationContext)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:



    If I Comment the following lines Or Set the DisplayDateEnd to DateTime.Now() then it works fine.

    dateCtrl.DisplayDateStart = Convert.ToDateTime("01/01/2003", System.Globalization.CultureInfo.CurrentCulture);                       
    //dateCtrl.DisplayDateEnd = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture); 
    dateCtrl.SelectableDateEnd = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture);                        
    dateCtrl.SelectedDate = Convert.ToDateTime("18/01/2010", System.Globalization.CultureInfo.CurrentCulture);

    Please let me know what can be the possible cause of this exception.

    Thanks,
    Anjan
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 04 Feb 2010 Link to this post

    Hi Anjan,

    Thank you for contacting us.

    The first thing causing that exception is the format of the date. It should be like: month/day/year. The second thing is that the SelectedDate and SelectableDateEnd should be in the interval of the DisplayDateStart and DisplayDateEnd dates, not equal to one of them.

    If you have further questions please feel free to contact us again.

    Greetings,
    Konstantina
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top