C# wpf BitmapImage 跨线程访问

//直接跨使用BitmapImage报异常 不能跨线程访问BitmapImage对象

//借助BitmapFrame 来访问


 var img = new BitmapImage(new Uri(fileName));

            this.imgControl.Dispatcher.Invoke(new Action(delegate
            {
                BitmapFrame frame = BitmapFrame.Create(img);
                this.imgControl.Source = frame;
            }));

版权声明:本文为zh_98原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。