This question is locked. New answers and comments are not allowed.
I have a grid column with the cell template below:
<telerikGridView:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<Image Source="{Binding HostNameUrl}" Stretch="None"></Image> |
<TextBlock Text="{Binding HostName}"></TextBlock> |
</StackPanel> |
</DataTemplate> |
</telerikGridView:GridViewDataColumn.CellTemplate> |
The HostNameUrl for the Image is a URL to a local resource I set from a property like:
public string HostNameUrl |
{ |
get{ |
string path = string.empty; |
switch(somevariable) |
case 1: |
return "Icons/FirstIcon.png"; |
case 2: |
return "Icons/SecondIcon.png"; |
} |
} |
This works perfect 99% of the time. Occasionaly I get this exception upon calling GridView.Rebind():
System.Exception: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) |
at MS.Internal.XcpImports.CheckHResult(UInt32 hr) |
at MS.Internal.XcpImports.FrameworkElement_SetStyleValue(FrameworkElement doh, DependencyProperty property, PropertyInvalidationReason reason) |
at System.Windows.DependencyObject.ClearValueInternal(DependencyProperty dp) |
at System.Windows.DependencyObject.ClearValue(DependencyProperty dp) |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item, Boolean isRecycled) |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item) |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.RemoveAll() |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnRefresh() |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) |
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args) |
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) |
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) |
at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) |
at Telerik.Windows.Data.DataItemCollection.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs e) |
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) |
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) |
at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) |
at Telerik.Windows.Data.QueryableCollectionView.RefreshAndRaiseCollectionChanged(NotifyCollectionChangedEventArgs args) |
at Telerik.Windows.Data.QueryableCollectionView.Refresh() |
at Telerik.Windows.Controls.DataControl.Rebind() |
at SightMaxSL.MainPage.EndInviteSessionToChat(Boolean success, UiVisitorSession session) |
what is strange, is that if i catch this exception, and immediately call Rebind(), it works and displays the proper image. Any pointers on where I should be looking?
Edit: i should note that it is an ObservableCollection<T> that I am binding the grid to.