Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: Dynamic updating of a processed WriteableBitmap in a WPF component

$
0
0
I have a WPF Image control, whose source is bound to a WriteableBitmap in my XAML code and this WriteableBitmap is continuously updated in the code behind. The bitmap is displayed in the image control and the window as long as it's not processed using WriteableBitmapEx methods. If I try to process the image before returning it to the UI control the image doesn't appear anymore.

Here are the code snippets:

XAML:
<Image x:Name="ImageControl" Source="{Binding ImageSource}" Stretch="Uniform" />
Bound method in the code behind:
public ImageSource ImageSource
        {
            get
            {
                return this.bitmap;
            }
        }
The above code works and the image displays properly.

If, however, I modify the last method and do something like:
public ImageSource ImageSource
        {
            get
            {
                return this.bitmap.Crop(20,20,200,200);
            }
        }
then the image doesn't appear anymore.

Anybody has a clue as to why that happens?

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>