2011-06-10 12 views
6

Tengo una vista particular con un DataGrid (silverlight 4). Pero tengo un proyecto donde los recursos se han fusionado con otro proyecto (para el respaldo). Ahora, después de esta fusión, recibo este error cada vez que trato de agregar un nuevo proyecto de fila a mi ObservableCollection ... mi teoría es que algo está mal con el xaml (¡que puedo tocar!) O, con suerte, el recursos fusionados (estilos & pinceles).¿Qué significa esto generalmente, Error HRESULT E_FAIL ha sido devuelto desde una llamada a un componente COM.?

MS.Internal.WrappedException was unhandled by user code 
    Message=Error HRESULT E_FAIL has been returned from a call to a COM component. 
    StackTrace: 
     at MS.Internal.XcpImports.CheckHResult(UInt32 hr) 
     at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize) 
     at System.Windows.UIElement.Measure(Size availableSize) 
     at System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32 slot, UIElement element, Boolean wasNewlyAdded, Boolean updateSlotInformation) 
     at System.Windows.Controls.DataGrid.OnAddedElement_Phase1(Int32 slot, UIElement element) 
     at System.Windows.Controls.DataGrid.OnInsertedElement_Phase1(Int32 slot, UIElement element, Boolean isCollapsed, Boolean isRow) 
     at System.Windows.Controls.DataGrid.InsertElement(Int32 slot, UIElement element, Boolean updateVerticalScrollBarOnly, Boolean isCollapsed, Boolean isRow) 
     at System.Windows.Controls.DataGrid.InsertElementAt(Int32 slot, Int32 rowIndex, Object item, DataGridRowGroupInfo groupInfo, Boolean isCollapsed) 
     at System.Windows.Controls.DataGrid.InsertRowAt(Int32 rowIndex) 
     at System.Windows.Controls.DataGridDataConnection.NotifyingDataSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) 
     at System.Windows.Data.PagedCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) 
     at System.Windows.Data.PagedCollectionView.ProcessAddEvent(Object addedItem, Int32 addIndex) 
     at System.Windows.Data.PagedCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) 
     at System.Windows.Data.PagedCollectionView.<.ctor>b__0(Object sender, NotifyCollectionChangedEventArgs args) 
     at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) 
     at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item) 
     at System.Collections.ObjectModel.Collection`1.Add(T item) 
InnerException: 
     Message=Error HRESULT E_FAIL has been returned from a call to a COM component. 
     StackTrace: 
      at MS.Internal.XcpImports.CheckHResult(UInt32 hr) 
      at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize) 
      at System.Windows.FrameworkElement.MeasureOverride(Size availableSize) 
      at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight) 
     InnerException: 
+0

Suena como si hubieras encontrado un error genuino. Intenta crear un proyecto lo más simple posible que reproduzca el problema. Use el sitio de Connect de Microsoft para reportarlo. También podría considerar repetir esta pregunta en los propios foros Silverlight de Microsoft, los chats de soporte de MSFT son más activos allí. – AnthonyWJones

Respuesta

20

Esto generalmente significa que hay un problema con el XAML que no pudo ser validada en tiempo de diseño, pero se manifestaría en tiempo de ejecución. Dado su escenario, supongo que la fila que está agregando puede causar que una de las plantillas de la columna Datagrid presente un error de esta manera.

Esto generalmente se debe a una referencia a un controlador de estilo o evento que no existe o que no está dentro del contexto del XAML. En mi experiencia, esta es una ocurrencia común en el desarrollo de control personalizado.

Consulte mi respuesta a una pregunta similar here.

HTH.

+0

El enlace ya no funciona, ¿quizás hay otra forma de vincularlo? – NotAGenie

Cuestiones relacionadas