2014-10-30 25 views
0

在我的silverlight应用程序中我发现这个错误,当我试图将itemssource分配给列表框.Error HRESULT E_FAIL has在System.Windows从呼叫被退回到COM组件在我的Silverlight应用程序中,我发现这个错误.Error HRESULT E_FAIL已经从调用COM组件返回

在MS.Internal.XcpImports.CheckHResult(UInt32的小时) 在MS.Internal.XcpImports.SetValue(IManagedPeerBase OBJ,的DependencyProperty属性,布尔b) .DependencyObject.SetValue(的DependencyProperty属性,布尔b) 在System.Windows.Controls.ItemsControl.ClearContainers(布尔bHostIsReplaced) 在System.Wi ndows.Controls.ItemsControl.ItemsSourceChanged(DependencyObject的d,DependencyPropertyChangedEventArgs E) 在System.Windows.DependencyObject.RaisePropertyChangeNotifications(的DependencyProperty DP,对象的属性oldValue,对象newValue)以在System.Windows.DependencyObject.UpdateEffectiveValue(的DependencyProperty属性,EffectiveValueEntry oldEntry,EffectiveValueEntry & newEntry,ValueOperation操作) 在System.Windows.DependencyObject.SetValueInternal(的DependencyProperty DP,对象的值,布尔allowReadOnlySet,布尔isBindingInStyleSetter) 在System.Windows.Controls.ItemsControl.set_ItemsSource(IEnumerable的值) 在HRPMS.MyDesk.ConferenceRoomBooking .AddSourceToListBox() at HRPMS.MyDesk.ConferenceRoomBooking.chkbxC​​CConsultant_Unchecked(Object sender,RoutedEventA RGS E) 在System.Windows.Controls.Primitives.ToggleButton.OnUnchecked(RoutedEventArgs E) 在System.Windows.Controls.Primitives.ToggleButton.OnIsCheckedPropertyChanged(的DependencyObject d,DependencyPropertyChangedEventArgs E) 在System.Windows.DependencyObject.RaisePropertyChangeNotifications(的DependencyProperty DP,对象的属性oldValue,在System.Windows在System.Windows.DependencyObject.RefreshExpression(的DependencyProperty DP) 在System.Windows.DependencyObject.UpdateEffectiveValue(的DependencyProperty属性,EffectiveValueEntry oldEntry,EffectiveValueEntry & newEntry,ValueOperation操作) 对象newValue)以 .Data.BindingExpression.SendDataToTarget() at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener se的nDer,PropertyPathChangedEventArgs参数) 在System.Windows.PropertyPathListener.ReconnectPath() 在System.Windows.Data.Debugging.BindingBreakPoint。 <> c__DisplayClass4.b__3()

回答

1

我这十几次,如果我没有记错它通常发生时,有一个ViewTemplate的时刻将被实例化或切换到可视的XAML一个问题(或一个VisualState变化被触发)。

较好的选择是:

  • 引用StaticResources无法找到
  • 的VisualState变化和目标不能被发现,或静态资源不能被发现,或为DiscreteObjectKeyFrameValue无法翻译对于最后一点的目标类型

比较这两个,有这样往往:

<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="True"/> 

<DiscreteObjectKeyFrame KeyTime="0:0:0"> 
    <DiscreteObjectKeyFrame.Value> 
     <System:Boolean>True</System:Boolean> 
    </DiscreteObjectKeyFrame.Value> 
</DiscreteObjectKeyFrame> 
相关问题