I'm getting the following error every time my Silverlight application load and cannot figure out how to get around it. This error occurs right when the UserControl is loaded (but before the Source is bound). I've tried handling this error during the ImageFailed event, but it is not fired when this exception is thrown. What can I do?
<Image
x:Name="EmployeeImage"
Source="{Binding Path=ImageUrl}"
Stretch="UniformToFill">
</Image>
Edit (clarification): I have an Employee object which contains an ImageUrl field. My UserControl's DataContext is bound to a ViewModel object which contains a SelectedEmployee property. So my Image element binds to the SelectedEmployee's ImageUrl property. This works great, EXCEPT when the Image is first loaded (and before the DataContext is bound). If I instantiate the SelectedEmployee in the ViewModel's constructor then the error goes away. If I don't, I get the error. This is strange to me, because instantiating a new Employee object results in the ImageUrl being null. Either way, the Image successfully binds when the DataContext is set (and the Employee object is populated with data). I'd just like to figure out why I am getting the error.
Thanks!