void SetBackgroundColor(ImageSource img) { if (img != null) { img.Freeze(); if (backgroundcolor_THREAD != null) backgroundcolor_THREAD.Abort(); backgroundcolor_THREAD = new Thread(new ParameterizedThreadStart(SetBackgroundColor_Worker)); backgroundcolor_THREAD.Start(img); } }
private static void ImagePropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { ImageBox imgBox = (ImageBox)dependencyObject; imgBox.SetBackgroundColor(eventArgs.NewValue as ImageSource); }