Posted
on Apr 17, 2010
(permalink)
Is there any reason why I should be getting this error for a very simple MVVM scenario binding a Command either through Xaml or Code Behind? I am using the 2010 Q1 controls and this is a RadRibbonButton. It's binding to a DelegateCommand<bool> in this case. I get an "object reference not set" error when the RibbonBar shows up even though the Command in the VM has already been instantiated and the ViewModel is already bound to the DataContext of the UserControl. This makes no sense since I use the same pattern for every commanding scenario and this is the first time I've tried it with Rad controls.
at Microsoft.Practices.Composite.Presentation.Commands.DelegateCommand`1.System.Windows.Input.ICommand.CanExecute(Object parameter)
at Telerik.Windows.Controls.RadButton.CanExecuteApply()
at Telerik.Windows.Controls.RadButton.ChangeCommand(ICommand oldCommand, ICommand newCommand)
at Telerik.Windows.Controls.RadButton.OnCommandChanged(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.SourceAcquired()
at System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)
at System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)
at System.Windows.DataContextChangedEventHandler.Invoke(Object sender, DataContextChangedEventArgs e)
at System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)
at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)
at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)
at System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent, Boolean bIsNewParentAlive)
at System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent, IManagedPeer newParent, Boolean bIsNewParentAlive, Boolean keepReferenceToParent)
at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent)