Reputation: 3
I'm getting the exception The provided DependencyObject is not a context for this Freezable, when trying to assign the Source of Image control.
In xaml the image control is created.
<Image x:Name ="DestinationImage" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" />
The source is set from code behind.
public ImageSource DestinationImageSource
{
get { return DestinationImage.Source; }
set
{
if (DestinationImage.Source != value)
{
OnPropertyChanging("DestinationImageSource");
DestinationImage.Source = value;
OnPropertyChanged("DestinationImageSource");
}
}
}
I tried checking whether the control is frozen "DestinationImage.Source.IsFrozen". But the IsFrozen property is false, still the exception comes on assigning the ImageSource.
Upvotes: 0
Views: 39