The scenario is the following:
I use a RadBook inside a Page that loads through the classic Navigation system from silverlight. The RadBook show a number of images as a book that come as entities from a ria service. I have a viewmodel class that holds an ObservableCollection of those image classes (the url of the image and some metadata) and an integer to hold the current page. I have done a declarative binding of those two with ItemsSource and RightPageIndex (mode=TwoWay) respectively. Everything seems to work smoothly the first time. After a navigation to another collection of images the problem starts. The images load ok but when I try to change the RightPageIndex through the binded property I get the following
A first chance exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Controls.Navigation
Exception Object reference not set to an instance of an object., StackTrace: at Telerik.Windows.Controls.RadBook.OnCurrentSheetIndexChanged(Int32 newValue, Int32 oldValue)
at Telerik.Windows.Controls.RadBook.set_CurrentSheetIndex(Int32 value)
at Telerik.Windows.Controls.RadBook.OnRightPageIndexChanged(Int32 rightPageIndex)
at Telerik.Windows.Controls.RadBook.OnRightPageIndexPropertyChanged(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.RefreshExpression(DependencyProperty dp)
at System.Windows.Data.BindingExpression.SendDataToTarget()
at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source)
at System.Windows.CLRPropertyListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args)
at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args)
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
at ePaper.ViewModels.ViewModelBase.OnPropertyChanged(String propertyName)
I must mention that on the delegate called after the load of gallery items from the ria service I Clear the ObservableCollection and initialize the RightPageIndex to -1.
I use a RadBook inside a Page that loads through the classic Navigation system from silverlight. The RadBook show a number of images as a book that come as entities from a ria service. I have a viewmodel class that holds an ObservableCollection of those image classes (the url of the image and some metadata) and an integer to hold the current page. I have done a declarative binding of those two with ItemsSource and RightPageIndex (mode=TwoWay) respectively. Everything seems to work smoothly the first time. After a navigation to another collection of images the problem starts. The images load ok but when I try to change the RightPageIndex through the binded property I get the following
A first chance exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Controls.Navigation
Exception Object reference not set to an instance of an object., StackTrace: at Telerik.Windows.Controls.RadBook.OnCurrentSheetIndexChanged(Int32 newValue, Int32 oldValue)
at Telerik.Windows.Controls.RadBook.set_CurrentSheetIndex(Int32 value)
at Telerik.Windows.Controls.RadBook.OnRightPageIndexChanged(Int32 rightPageIndex)
at Telerik.Windows.Controls.RadBook.OnRightPageIndexPropertyChanged(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.RefreshExpression(DependencyProperty dp)
at System.Windows.Data.BindingExpression.SendDataToTarget()
at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source)
at System.Windows.CLRPropertyListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args)
at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args)
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
at ePaper.ViewModels.ViewModelBase.OnPropertyChanged(String propertyName)
I must mention that on the delegate called after the load of gallery items from the ria service I Clear the ObservableCollection and initialize the RightPageIndex to -1.