This is a migrated thread and some comments may be shown as answers.

System.Runtime.Serialization.SerializationException occurs when binding is incorrect

1 Answer 139 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Adam Salvo
Top achievements
Rank 1
Adam Salvo asked on 23 Mar 2011, 06:28 PM
I am working with the TimeBar control in a MVVM environment (CaliburnMicro) and am trying to bind the PeriodEnd and PeriodStart properties of the TimeBar. I was getting some exceptions and thought I would pass along what I did to get it working. The key was to make sure to set a FallBackValue in the binding like so:
 
PeriodEnd="{Binding PeriodEnd, FallbackValue='12/31/2011'}"

I was getting two seperate exceptions depending on if I was trying to bind the PeriodEnd or PeriodStart.

PeriodEnd Exception:

System.Runtime.Serialization.SerializationException

Type 'System.Windows.LayoutCycleException' in assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not marked as serializable.


PeriodStart Exception:

The added or subtracted value results in an un-representable DateTime.
Parameter name: value
   at System.DateTime.AddTicks(Int64 value)
   at System.DateTime.Add(Double value, Int32 scale)
   at System.DateTime.AddDays(Double value)
   at Telerik.Windows.Controls.TimeBar.WeekInterval.ExtractIntervalStart(DateTime date)
   at Telerik.Windows.Controls.TimeBar.PeriodSpanGenerator.GenerateModels(DateTime periodStart, DateTime periodEnd, Func`2 extractIntervalStartAction, Func`2 incrementAction)
   at Telerik.Windows.Controls.TimeBar.IntervalDescriptor.UpdatePeriods(DateTime periodStart, DateTime periodEnd)
   at Telerik.Windows.Controls.RadTimeBar.SynchronizeIntervalDescriptors()
   at Telerik.Windows.Controls.RadTimeBar.EndInit()
   at MS.Internal.FrameworkCallbacks.SupportInitializeEndInit(IntPtr nativeTarget)

While trying to figure out what was going on, I tried binding the TimeBars height property, which worked as I expected. However, if the view model property does not exist (like if you mis-spell it in the binding), then I got the same exception as with PeriodEnd (SerializationException). However this behavior does not occur on the RadChart control, or the out of the box silverlight controls. So it would seem that the TimeBar could use some better error handling, but I realize it's still in beta.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 25 Mar 2011, 11:09 AM
Hello Adam Salvo,

Thank you for using RadTimeBar! Indeed we reproduced this issue internally and it is logged now in our PITS system here. Due to the severity of this issue it will be placed high in our priorities and you can expect a fix in one of the upcoming LIB released every Monday.

Again thanks a bunch for your feedback! Your telerik points have been updated.

Regards,
Yavor Ivanov
the Telerik team
Tags
TimeBar
Asked by
Adam Salvo
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or